Disable ZIP validation
-
Hi Woocommerce team,
I have a webshop with digital products (no physical delivery).
Under Woocommerce/Settings/Sell to specific countries, I have enabled specific countries where I am selling to.
However, ZIP code can be tricky in some countries and during the checkout my visitors have challenges writing the right format. If it is not the right format, the “Please enter a valid postcode” text appears.As there is no delivery of physical products, how can I remove/disable this validation?
Is there a default configuration option for this?I can re-write the “Postal code” label to “Postal code (eg. 1170)” but it would be only an example for one country and of course it is not a nice solution for all countries.
add_action( 'wp_footer', function () {
if ( ! is_checkout() ) {
return;
}
?>
<script>
document.addEventListener('DOMContentLoaded', function () {
const interval = setInterval(function () {
const postcodeLabel = document.querySelector('label[for="billing-postcode"]');
if (postcodeLabel) {
postcodeLabel.textContent = 'Postal code (eg. 1170)';
clearInterval(interval);
}
}, 300);
});
</script>
<?php
});Thank you in advance!
The page I need help with: [log in to see the link]
You must be logged in to reply to this topic.