I want an item 3210 to be excluded from the Minimum Order Value Rule so that customers can order item 3210 without having to reach the MOQ of 100,- minimum order value.
Hope that makes sense!
Minimum Order Value exception
Closed
Comments
Hello Rob,
I believe you can use the following PHP code snippet for that:
add_filter('b2bking_minmax_order_total_calculation_basis', function($value){
$cart = WC()->cart->get_cart();
$product_id_to_exclude = 1234;
$has_another_item = false;
foreach ($cart as $cart_item_key => $cart_item) {
if ($cart_item['product_id'] == $product_id_to_exclude || $cart_item['variation_id'] == $product_id_to_exclude) {
// this item
} else {
$has_another_item = true;
}
}
if ( ! $has_another_item ){
$value = 99999999;
}
return $value;
}, 10, 1);Replace 1234 with the ID of the product.
It should allow ordering that product regardless of MOQ.
Kind regards,
Thomas
1