How to Disable Zip Code Validation in Sydney Pro


#1

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:


#2

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


#3

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


#4

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


#5

Thanks for the effort, Kharis

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


#6

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


#7

I think we have a winner!!!

THANK YOU very much

Phillip


#8

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