Код: Выделить всё
add_filter( 'woocommerce_cart_shipping_method_full_label', 'custom_shipping_method_full_label', 10, 2 );
function custom_shipping_method_full_label( $label, $method ) {
if ( !in_array( $method->get_method_id(), array( 'free_shipping', 'local_pickup' ), true ) && 0 < $method->cost ) {
$label = $method->get_label(); // Get shipping label without cost
$new_cost = $method->cost - get_total_subsidies( WC()->cart->get_cart() );
if ( $new_cost > 0 ) {
$method->cost = $new_cost;
$label .= ': ' . wc_price( $new_cost );
} else {
$method->cost = 0;
$label .= ': ' .' ' . __('Free!', 'woocommerce').'';
}
}
return $label;
}
Мне нужно, чтобы новая стоимость была текущая стоимость расчета итоговых сумм на страницах корзины и оформления заказа.
Подробнее здесь: https://stackoverflow.com/questions/788 ... rce-totals