add_filter ('woocommerce_package_rates', 'tl_shipping_on_price', 10, 2);function tl_shipping_on_price ($ нормы, $ пакет) {
$total = WC()->cart->cart_contents_total;
if( $total <= 50 ) {
foreach ( $rates as $rate_key => $rate ) {
if ( 'free_shipping' === $rate->method_id ){
// $free_available = true;
unset($rates[$rate_key]);
break;
}
}
} else {
// unset( $rates['flat_rate'] );
// unset( $rates['free_shipping'] );
}
// print_r ($ ставки); выход;возвратные ставки в долларах;} enter code here