woocommercewoothemes

disable postcode validation in WooCommerce checkout page


Does anybody know how to disable the Postcode validation on the checkout page in WooCommerce?

I want to input 'text content' in "billing_postcode" field, but the shop says it's an invalid postcode.

Does anyone know how I can disable Postcode validation or allow text characters?


Solution

  • Just do this:

    add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields', 99 );
    
    function custom_override_checkout_fields( $fields ) {
    
        unset($fields['billing']['billing_postcode']['validate']);
        unset($fields['shipping']['shipping_postcode']['validate']);
    
        return $fields;
    }
    

    You can put this pretty much anywhere, but preferably in a custom plugin or in your theme's functions.php