• Resolved itsViney

    (@itsviney)


    I have several shipping zone set-up with various delivery options, as well as a delivery zone where the only option is ‘Local pickup’. My problem is that we often get customers who live in the ‘Local pickup’-only zone, but don’t notice that that option is the only one available. This seems to be because when only one method is available for a given order, WooCommerce automatically selects that option.

    Can I disable this behaviour? I would rather users get an error that no shipping method has been selected, and prompt them to actively select the ‘Local pickup’ option, even though it’s the only one available.

    I’ve tried adding

    add_filter('woocommerce_shipping_chosen_method', '__return_false', 99);

    but that doesn’t seem to do what I’m after.

    • This topic was modified 3 years, 6 months ago by itsViney.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Hello,

    Have you cleared browser cache and then tried placing a test order? Or you could check in incognito mode. The snippet code above works properly on my test site. No default shipping pre-selected, and the message “No shipping method has been selected” shows up if trying to place order without selecting a shipping option.

    Thread Starter itsViney

    (@itsviney)

    Hi @maykato . Does your test site use single-page (ajax) checkout? That’s what mine is using at that filter definitely doesn’t prevent the shipping method being auto-selected, if the user’s address only has one available option.

    • This reply was modified 3 years, 6 months ago by itsViney.

    Hi,

    OK, I tried the code on my test site with different zones, and noticed if there is only one shipping method available for a particular zone, the available shipping method shows up preselected – it only works when there are multiple shipping options available.

    That said, your requirement would involve further customization – which goes beyond the scope of support we are able to provide in this forum.

    I can also recommend the WooCommerce Developer Resources Portal for resources on developing for WooCommerce.

    You can also visit the WooCommerce Facebook group or the #developers channel of the WooCommerce Community Slack.

    Hi @itsviney

    We’ve not heard back from you in a while, so I’m marking this thread as resolved. If you have further questions, please feel free to open a new topic.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Force user to confirm shipping method, even if only one is available’ is closed to new replies.