Navigation
This is archived content. Visit our new forum.

Tagged: 

  • Author
    Posts
  • #1313866
    dan
    Participant

    In my country we don’t use the zip codes/postcodes too much and many people have no idea what’s their postcode. How can i make it an optional field instead being a required field?

    #1313867
    dan
    Participant
    This reply has been marked as private.
    #1313888
    Paul R
    Moderator

    Hi,

    To make it optional, you can add the code below in your child theme’s functions.php file(wp-content/themes/x-child/functions.php).

    
    add_filter( 'woocommerce_default_address_fields' , 'custom_override_default_postcode_fields' );
    
    function custom_override_default_postcode_fields( $postcode_field ) {
         $postcode_field['postcode']['required'] = false;
    
         return $postcode_field;
    }
    

    Hope that helps.

    #1314656
    dan
    Participant

    It works perfect! Thanks a lot !

    #1314770
    Jade
    Moderator

    You’re welcome.

  • <script> jQuery(function($){ $("#no-reply-1313866 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>