How to Disable Zip Code Validation in Sydney Pro

Hi, due to the various different standards for zip codes around the world, I would like to disable the zip code validation feature. (My e-commerce site sells only e-books and there is no shipping of a physical product so I do not need this feature)

Is the a code I could use to do this ?

Many thanks in advance for your help.

Phillip

Please see the error users are getting:

Hello there,

To disable it, try adding this snippet to your child theme’s functions.

    add_filter( 'woocommerce_default_address_fields' , 'sydneypro_disable_postcode_validation' );
    function sydneypro_disable_postcode_validation( $address_fields ) {
      $address_fields['postcode']['required'] = false;
      return $address_fields;
    }

If you don’t run a child theme, you can use a plugin that does the same purpose like Functionality.

Regards,
Kharis

Thanks Kharis.

It is still actually there unfortunately. And I am running a child theme. Is there any other coding or plugin that you could recommend?

Thanks again

Hello there,

From the source code of your site, I found site caching has been applied. You might need to flush it whenever adding a new code or doing some changes. Otherwise it won’t take any effect in the front end.

https://codex.wordpress.org/I_Make_Changes_and_Nothing_Happens

Regards,
Kharis

Thanks for the effort, Kharis

Unfortunately nothing. (I am using “My Custom Functions” to enter any special coding by the way)

Alternatively you could usethe Woo Checkout Field Editor plugin. Once enabled, go to WooCommerce menu > Checkout Form; edit Postcode/ZIP. Disable the required option.

06

Regards,
Kharis

I think we have a winner!!!

THANK YOU very much

Phillip

Great!

You’re welcome! Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis

Hi - I have a similar, yet different issue. In the cart page of Woocommerce there is an option to have a shipping quote by inserting country, city, zip. However, the zip code field is not mandatory but the shipping calculator is controlled by zip codes in the Woocommerce shipping settings (and not cities to my knowledge). This mean that users will get a “no shipping options found” if they only insert a city and not a zip. If the zip field was mandatory this would not happen. Any creative solutions on making this zip field mandatory?

Thanks

Hi,

WooCommerce has the ZIP code as mandatory field by default and Sydney theme doesn’t change it.

Perhaps you have a plugin that mofify the checkout fields like Checkout Field Editor.

Regards,
Kharis
aThemes Support

Hi Kharis - no, in the cart page there is a shipping calculator that pulls a quote based on the Woo shipping settings. However, this calculator has both City and Zip as optional fields, creating a situation where users could enter only a city and as a result get no shipping options (since the shipping zones are set up based on zip numbers).

However, I managed to get an input from a Woocommerce supporter that the city input field can be hidden by using:

    add_filter( 'woocommerce_shipping_calculator_enable_city', '__return_false' );

Thereby leaving only the Zip code input field showing and forcing users to input zip if they want a shipping quote.

Anyway - just as a reference if others have the same issue.

Thanks.

1 Like

Hi,

Glad to know you found the solution and Thank you so much for sharing it here with the code, that’s really appreciated.

Please let us know in a new topic if you have any further questions, or if we can provide you with any other assistance.

Regards,
Kharis
aThemes Support