Validation Of Checkout Pincode or Zipcode Field in Woocommerce

You can limit the zip code field digits to validate it properly. If in your country zip code is of minimum 4, 5, or 6 digits then you can use woocommerce checkout process function add_action code to validate it for correct zip code entry by your customers. Let’s have a look.

Here is my code, Add below code at the end of your theme’s functions.php file of your active child theme (or theme) and Save the file to redirect the visitors to the custom-designed landing page of your choice.

In this code validate the zip code field for at least 6 digit number. If the entered number is less than or greater than 6 digits then it will show the error message and if it is correct it will let the checkout process complete. You can change the number to 4,5,6 or any other number depending on your country’s zip codes.


Free Exclusive Traffic Tips

About the Author: Dharmendra Yadav

Dharmendra Yadav is a PHP developer. Dharmendra Yadav background includes B.Tech in Computer Science and Engineering. Currently he is working with CORE PHP, CODEIGNITER, , Laravel, Opencart, JAVASCRIPT, JQUERY, AJAX, WORDPRESS, WEB API technologies , Smarty.

You May Also Like

Leave a Reply

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