Untitled
webwizards
Plain Text
10/13/2025 3:42 PM
811 B
13
Indexable
Never
add_filter('b2bking_minmax_order_total_calculation_basis', function($basis){
// Array of product IDs that should override the minimum order value
$target_product_ids = array(1234, 5678, 9012); // Add all your product IDs here
if (!WC()->cart || WC()->cart->is_empty()) {
return $basis;
}
// Loop through cart items to check for the specific products
foreach (WC()->cart->get_cart() as $cart_item) {
$product_id = $cart_item['product_id'];
$variation_id = $cart_item['variation_id'];
// Check if either the product ID or variation ID matches any target ID
if (in_array($product_id, $target_product_ids) || in_array($variation_id, $target_product_ids)) {
return 1000;
}
}
return $basis;
}, 10, 1);Editor is loading...
Leave a Comment