skip to Main Content
Due to personal health issues there is currently a delay in support response time.
I greatly apologize for this inconvenience and will respond to each ticket as soon as I can.

Limit Options Based On Date

There are some scenarios where a shipping option is only available on certain days of the week. Let’s say you offer ‘Saturday Delivery’, but this option is only available to customers who purchase their items on a Wednesday or Thursday. To make this happen, you will need to first setup a row in your table of rates for this option. Then with the help of an external code snippet, you can show or hide this option depending on what day of the week today is. The screenshot below illustrates the two options available to a customer: Standard Delivery and Saturday Delivery. The code snippet that follows shows how to modify the output so that Saturday Delivery only shows up on the cart page on Wednesdays and Thursdays.


function modify_saturday_delivery( $packages ) {
    global $woocommerce;

    foreach( $packages as $key => $pkg ) {
        if( isset( $pkg['rates']['table_rate_shipping_saturday-delivery'] ) &&
            (date('l') != 'Wednesday' && date('l') != 'Thursday') )
                unset( $packages[ $key ]['rates']['table_rate_shipping_saturday-delivery'] );

    return $packages;

add_action('woocommerce_shipping_packages', 'modify_saturday_delivery');
  • Was this article helpful ?
  • yesno
0 out of 0 visitors found this article helpful
Views: 95
Back To Top