How can I change the ‘Zip’ field label to say ‘Postal Code’?

Article Last Updated: July 10, 2017

Many of our international users have requested the ability to swap out the ‘Zip’ label for some other bit of text, ‘Postal Code’ for example.

To alter the field label You can use one of the built in filters to change any of the form field labels. We’ve built in a ton of hooks and filters for users to take advantage of, to allow for customization beyond what can be done in the admin dashboard. The filter you’ll want to use to alter the label text is:

yikes-mailchimp-address-$field_type-label

Where $field_type is the form field type. Since the field is nested inside of the address field, $field_type can be any of the following:

  • addr1
  • addr2
  • city
  • state – US/CA Only
  • zip – US/UK Only
  • country

Since we’ll be altering the label for the ‘Zip’ field, you can substitute ‘zip’ for $field type in the filter, like so: yikes-mailchimp-address-zip-label.

Example:

If you are an international user, specifically from the UK, you’ll also want to change the regex pattern used to validate the zip code entered by the user. By default, the regex pattern used validates US zip codes only (\d{5,5}(-\d{4,4})?).

We’ve included an additional filter to allow for our users to alter, or remove, the regex pattern used to validate the zip code. Obviously, if you’re outside of the United States – you don’t only want to accept US formatted zip codes.

If you’ll be accepting zip codes from all over the world, your best bet is to input a custom regex pattern for the zip (postal code) fields. The following snippet will do just that, and allow any value to pass through the validation check: