Код: Выделить всё
add_filter( 'woocommerce_package_rates', 'custom_shipping_costs_based_on_products_cost', 20, 2 );
function custom_shipping_costs_based_on_products_cost( $rates, $package ) {
$products_amount = WC()->cart->cart_contents_total;
$taxes_amount = WC()->cart->get_cart_contents_tax();
$total = $products_amount + $taxes_amount;
if ($total > 99.98) {
foreach( $rates as $rate_key => $rate ){
if( $rate->method_id == 'alg_wc_shipping:198'){
$rates[$rate_key]->cost = 0;
}
}
}
return $rates;
}
Код: Выделить всё
Подробнее здесь: https://stackoverflow.com/questions/792 ... ditionally