Support » Plugin: WooCommerce » “No shipping method chosen” after 4.0 update

  • Resolved lilmofo

    (@lilmofo)


    We have a multistep checkout based on flatsome theme and the site is served to 3 different countries, that we ship to.

    Now that I am testing with Woo4.0, in our address form we do not show a shipping method selection. We offer one generic method per country. But when clicking continue the address form validation complains about the missing shipping method โ€“ which it did not in Woo 3.9.3.

    When overriding the filter WC()->cart->needs_shipping() with something like this:
    add_filter(‘woocommerce_cart_needs_shipping’, function() { return false; }); I can continue in the checkout and create the order, but obviously it will then be created without a shipping line item.

    Is there a way to pre-select a shipping method and store it in the cart/session based on my current domain/country, in order to avoid this error?

Viewing 7 replies - 1 through 7 (of 7 total)
  • I was having the same problem with 4.0 not providing any shipping methods for certain countries. I looked through the code and found the issue:

    1) There will be no shipping method unless the customer selects his country AND state with postal code.

    2) If a customer does not manually enter in a state or only has the country (via geolocation) in the cart checkout, it will return the message โ€œthere are no shipping options for (name of country)โ€

    Apparently the requirement to have a state and zip code before the shipping method would be available was put in by the developers, and it is having a massive impact on merchants. Not sure why they would do that as it may mislead some customers to think that there are no shipping options to their country, unless they key in their full address (which many customers will probably not do if they see the no shipping method messsage).

    You need to edit the wc-class-shipping.php (within the includes folder) and revert it to the Woocommerce 3.9 code which allows shipping methods based on country alone.

    I hope this helps as I am also affected by this update

    Plugin Support AW

    (@slash1andy)

    Automattic Happiness Engineer

    Hey there!

    The issue with having no shipping method when only the country is known (in countries that WooCommerce has states set up for, like the US) is being worked on for WooCommerce 4.0.1. That should resolve this issue for you. Sorry for the inconvenience.

    If you add the following filter in your themes functions.php which should display the state for all countries it will fix the issue:

    add_filter( 'woocommerce_states', 'xa_filter_woocommerce_states', 10, 1 );

    My theme still does not display the state but the problem is gone.

    Not working for me. I use storefront and get an error.

    Warning: call_user_func_array() expects parameter 1 to be a valid callback, function ‘xa_filter_woocommerce_states’ not found or invalid function name in …..

    @slash1andy when will be 4.0.1 ready ?

    Plugin Support AW

    (@slash1andy)

    Automattic Happiness Engineer

    add_filter( ‘woocommerce_states’, ‘xa_filter_woocommerce_states’, 10, 1 ); is not a full function, and will not work unless that already exists.

    We don’t have a timeline for when it will be released, but you can follow along with development here: https://github.com/woocommerce/woocommerce

    Hello,

    Why this topic marked as resolved? Is it possible to provide some code for functions until the official release 4.0.1?

    None of our customers from countries where there are states can place an order ๐Ÿ™

    ps or how to do a painless downgrade to version 3.9?

Viewing 7 replies - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.