• Resolved apg1912

    (@apg1912)


    On my checkout page I have a number of shipping options that the customer can select from. They are the typical: Free Delivery, Standard Delivery and Special Delivery.

    However, there is also a Saturday Guaranteed option which is a Special Delivery guaranteed to arrive on Saturday, as opposed to Monday.

    What I am wanting to do, is only display the Saturday Guaranteed option on a Thursday or Friday up to a specified time, otherwise it doesn’t want to show.

    I’m guessing the shipping options may possibly be available for customisation in a Filter, or there may even be an Action that enables me to have some sort of control over these, but I haven’t found them yet.

    I’m basically wanting to check the time and date and use them to determine whether the Saturday Guaranteed is displayed or not.

    If anybody can offer any advice in this, it would be most welcome.

    thanks

Viewing 6 replies - 1 through 6 (of 6 total)
  • Hi
    I can give you idea but you need to modify this function little bit.

    // Enable free shipping on specific days of the week

    add_filter( 'woocommerce_shipping_free_shipping_is_available', 'ahir_wp_enable_free_shipping_for_specific_week_days', 10, 3 );
    function ahir_wp_enable_free_shipping_for_specific_week_days( $is_available, $package, $shipping_method ) {
        // Free shipping is available on mondays and wednesdays for example
        if( in_array( date('w'), [ 1, 3 ] ) ) {
            return true;
        }
        return $is_available;
    }

    I have use date() function with “w” parameter that gives an integer from 0 (Sunday) to 6 (Saturday):
    So you need to get shipping method and customize above function.

    Thanks
    Ahir

    Thread Starter apg1912

    (@apg1912)

    Thank you for the reply, but it’s not Free Shipping I want to control. It’s something called Saturday Guaranteed.

    but if you print $shipping_method, you will get all shipping method. you can do like:

    if ( ‘your_shipping_methos’ === $shipping_method ) {
    // do custom code here
    }

    Thread Starter apg1912

    (@apg1912)

    I see. Thanks again. I will give that a try.

    Thread Starter apg1912

    (@apg1912)

    I couldn’t get the suggestion to work in any shape or form. As there have been no other contributors, I’m happy to close this and I’ll continue to research it myself.

    Plugin Support Damianne P (a11n)

    (@drwpcom)

    Hi @apg1912. I recommend the following places for more development-oriented questions:

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Shipping Options Control’ is closed to new replies.