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

How to Show WooCommerce Free Shipping Before A Certain Time?

If you’re interested in customizing your WooCommerce checkout page with a persuasive message that encourages customers to take advantage of free shipping by placing their orders before a specified cutoff time, then this code snippet will assist you in achieving that.

// Display Free Shipping Before Certain Time in WooCommerce Checkout
function ts_display_free_shipping_message() {
    // Set the cutoff time for free shipping (24-hour format)
    $cutoff_time = '22:00'; // Change this to your desired cutoff time

    // Get the current time
    $current_time = current_time('H:i');

    // Check if the current time is before the cutoff time
    if (strtotime($current_time) < strtotime($cutoff_time)) {
        // Display the custom message
        echo '<p class="free-shipping-message">Order now and get free shipping before ' . $cutoff_time . '!</p>';
    }
}
add_action('woocommerce_before_checkout_form', 'ts_display_free_shipping_message');

Output

The below output adds a message above the WooCommerce checkout form, notifying customers about the opportunity for free shipping if they place their order before a specified cutoff time.

How to Show WooCommerce Free Shipping Before A Certain Time?

Alternatively, you can also display custom messages for free shipping in WooCommerce cart page.

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
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible.

Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.

By using our site, you acknowledge that you have read and understood our Privacy Policy and Terms & Conditions.