PHP Warning: Undefined variable $variation_id
-
Hello again,
So I have a client site whose logs are full of this warning. It seems that it’s breaking the checkout process for our wholesale clients when using credit card.
PHP Warning: Undefined variable $variation_id in /home/website/public_html/wp-content/plugins/whols/includes/functions.php on line 1287Version is 2.4.6 – Line 1287 is the bolded line here:
function whols_is_wholesale_priced( $product_id, $qty ){
$product_data = wc_get_product($product_id);
if($product_data->is_type('simple')){
$product_id = $product_data->get_id();
$variation_id = '';
} elseif( $product_data->is_type('variation') ){
$product_id = $product_data->get_parent_id();
$variation_id = $product_data->get_id();
}
$wholesale_status = whols_is_on_wholesale( $product_id, $variation_id );
$enable_this_pricing = $wholesale_status['enable_this_pricing'];
$price_value = $wholesale_status['price_value'];
$minimum_quantity = $wholesale_status['minimum_quantity'];
if( whols_is_wholesaler(get_current_user_id()) && $enable_this_pricing && $price_value && $qty >= $minimum_quantity ){
// Returned array in case we need to pass any other data in the future
return array(
'wholesale_priced' => 'yes'
);
}
return false;
}
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.