In Woocommerce, I'm trying to add an estimated delivery day range on cart and checkout pages.
I have set 2 shipping Zones: Germany and other European countries (outside Germany) called "DHL Europe". I need to display a different delivery day range for Germany shipping country than other European shipping countries:
- Germany shipping country will display "Lieferzeit 3-5 Werktage" (and when there is no shipping costs).
- Other European shipping countries will display "Lieferzeit 5-7 Werktage"
My code attempt:
function sv_shipping_method_estimate_label( $label, $method ) {
$label .= '<br /><small class="subtotal-tax">';
switch ( $method->method_id ) {
case 'flat_rate':
$label .= 'Lieferzeit 3-5 Werktage';
break;
case 'free_shipping':
$label .= 'Lieferzeit 3-5 Werktage';
break;
case 'international_delivery':
$label .= 'Lieferzeit 5-7 Werktage';
}
$label .= '</small>';
return $label;
}
add_filter( 'woocommerce_cart_shipping_method_full_label', 'sv_shipping_method_estimate_label', 10, 2 );
It works with the free_shipping
and flat_rate
shipping methods, but not for European deliveries (outside Germany).
What am I doing wrong?
How to display the correct date range for European countries (outside Germany)?