Black Friday & Cyber Monday SUPER SALE ALL WEEK:
Grab 40% OFF on plugins
Days
Hours
Minutes
Seconds

How to Display a Delivery Day Range Based on Shipping Country in WooCommerce Cart?


Worried about orders falling through the cracks because of inaccurate shipping costs? This code snippet has your back! By implementing it, you’ll automatically inform customers outside your regular shipping zone that they need to contact you for an accurate shipping cost.

add_filter( 'woocommerce_cart_shipping_method_full_label', 'ts_cart_shipping_country', 10, 2 );

function ts_cart_shipping_country( $label, $method ) {
    // The targeted country code
    $targeted_country_code = 'IN';

    if( WC()->customer->get_shipping_country() !== $targeted_country_code ){
        $days_range = '5-7'; // International
    } else {
        $days_range = '1-2'; // India
    }
    return $label . '<br /><small class="subtotal-tax">' . sprintf( __("Delivery time %s business days"), $days_range ) . '</small>';
}

Output

By implementing the below code, you’ll automatically inform customers outside your regular shipping zone that they need to contact you for an accurate shipping cost.

How to Display a Delivery Day Range Based on Shipping Country in WooCommerce Cart?

In another scenario, when we select any other countries from the dropdown, it will change the delivery day as shown below.

How to Display a Delivery Day Range Based on Shipping Country in WooCommerce Cart?

If you want to display delivery timeframes based on the customer’s shipping country after order processing, then you can also show custom message in WooCommerce checkout based on shipping country.

Browse more in: Code Snippets, WooCommerce How Tos, WooCommerce Tutorials

Share It:

Subscribe
Notify of
0 Comments
Newest
Oldest
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x