• Resolved MagineM

    (@maginem)


    Hi,

    Is there a way to disable the default shipping option, forcing the customer to make a selection before being able to complete checkout?

    I found the below script that does do this, but once the user makes a selection, that selection is kept for the session.

    // To test this code, open a private/incognito window, add an item to the cart and then go to cart page.
    // Once an option is choosen, it will be the default option from that moment onwards.
    
    // Code to clear default shipping option.
    add_filter( 'woocommerce_shipping_chosen_method', '__return_false', 99);
    
    // Code to clear default payment option.
    add_filter( 'pre_option_woocommerce_default_gateway' . '__return_false', 99 );
Viewing 4 replies - 1 through 4 (of 4 total)
  • Are you clearing customer seessions when testing? Woocommerce->Status->Tools->Clear customer sessions

    Thread Starter MagineM

    (@maginem)

    The customer clearing works (when manually doing so or testing in incognito mode), but I was wondering if it can be cleared automatically as soon as checkout has been finalised?

    jessepearson

    (@jessepearson)

    Automattic Happiness Engineer

    @maginem You would need to clear out the customer’s session after they checkout, or modify the variables in the session. Both will take more coding than what we are able to provide here.

    Kenin

    (@kbassart)

    Automattic Happiness Engineer

    We haven’t heard back from you in a while, so I’m going to mark this as resolved – if you have any further questions, you can start a new thread.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Default shipping option’ is closed to new replies.