WooCommerce ZIP Code Removal

WooCommerce zip code feature is a very useful feature if you are using province and district-based shipping rates. Since most e-commerce sites in the world use fixed fee shipping or free shipping, they do not need this feature much. If you want to remove the zip code from the WooCommerce payment form, simply add the […]

WooCommerce ZIP Code Removal

WooCommerce zip code feature is a very useful feature if you are using province and district-based shipping rates. Since most e-commerce sites in the world use fixed fee shipping or free shipping, they do not need this feature much. If you want to remove the zip code from the WooCommerce payment form, simply add the code below to your theme’s functions.php file.

The code below will override the Postcode field on the WooCommerce payment page. There are 2 methods to add this code to your theme’s functions.php file.

  • Adding manually: You can add the code to an available area of View> Theme Editor> functions.php file.
  • Adding with a plugin: You can add it using the Code Snippets plugin. Add the Code Snippets plugin to your site by going to Plugins> Add new and typing Code Snippets in the search field. After activating, open a new snippet from Snippets area in the left menu and add the following code. In this way, the code will be automatically added to your functions.php file without the need for manual action.
/**
* @snippet WooCommerce ZIP Code Removal
* @sourcecode https://www.wpservis.com/en/woocommerce-zip-code-removal
* @author Halim KILIÇ
* @testedwith WooCommerce 3.5.2
*/
 
add_filter( 'woocommerce_checkout_fields' , 'bbloomer_remove_billing_postcode_checkout' );
 
function bbloomer_remove_billing_postcode_checkout( $fields ) {
  unset($fields['billing']['billing_postcode']);
  return $fields;
}

After adding the code, the zip code feature of the WooCommerce payment form in the image below will be deleted.

woocommerce-zip-code

You can access all documents of the WooCommerce payment page from the tutorial article on the official page. If you have any questions, please let me know in the comments section.

Leave a Reply

Your email address will not be published. Required fields are marked *