• Resolved mipecs

    (@mipecs)


    Hi – in standard Woo shipping calculator functionality, users (to my understanding) are not required to enter both the city AND the Zip. Since the shipping zones are controlled based on the Zip code, you will not get any shipping options if the user only enters a city and hits enter. Only if a Zip is also entered (or just zip) will the calculator work properly. Isn’t this a functionality bug? Shouldn’t you be able to require the zip or is there a way to have the calculator understand city names and filter shipping options based on that as well as the zip code (e.g.when listing zip codes for a certain zone you could enter CITY:9999 and then user would get the shipping cost whether entering the city OR the zip).

    The simple solution would be to simply make the zip code field mandatory but how is that done?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter mipecs

    (@mipecs)

    Anyone??

    Hi @mipecs,

    That’s a great point. The cart shipping calculator isn’t aware of how the zones are set up. It doesn’t check to see if they are set by postcode, country, or some combination. It just takes what the user enters and pulls a shipping quote once they hit “update cart.”

    You could modify the fields so that it only shows the ZIP code. There are filters that allow us to change these fields. Try adding this to your theme’s functions.php file or use the Code Snippets plugin.

    
    add_filter( 'woocommerce_shipping_calculator_enable_city', '__return_false' );
    add_filter( 'woocommerce_shipping_calculator_enable_country', '__return_false' );
    add_filter( 'woocommerce_shipping_calculator_enable_state', '__return_false' );
    

    While it will remove the fields, it may also prevent this from working too. Make sure to check that out before activating it on your site.

    Cheers

    Thread Starter mipecs

    (@mipecs)

    Many thanks! That works well – however, hiding country and state, didn’t work as I then wouldn’t get any shipping options at all. So I simply used

    add_filter( ‘woocommerce_shipping_calculator_enable_city’, ‘__return_false’ );

    and kept the others that are pre-populated through the shipping settings.

    So now users only have to input their zip code and that is exactly what I was after!

    Thanks again!
    Michael

    Hey Michael,

    That’s a great workaround! Thanks for sharing what ended up working for you.

    Cheers!

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

The topic ‘Shipping calculation to require zip’ is closed to new replies.