Question about the mandatory use of postal codes

Hi there,

I just saw this new change at changelog: Shipments to Malta will soon require a postcode - Shopify Changelog

It says that post code for shipments to Malta changes from optional to required.

My question is: is there any Shopify site where we can check whether post code for a specific country is or not required? I could not find it and it would be very useful.

Kind regards

Hey @sinuhe, I’m not aware of a specific list of where this is required. Typically checkout would be blocked until this is provided.

Can you share more about how you would use this? I’d be happy to pass that on to our teams to consider adding this information somewhere.

Hi @KyleG-Shopify ,

it would be very useful when using the Ajax Cart API to generate shipping rates (Cart API reference). When using that tool for a specific country, it is important to know if the postal code is required or not for this country. If it is indeed required but it is not specified in the request, the API returns an error.

Imagine an app where you need to show a form with country, region and optional postal code so that the user enters an address and then the API calculates the shipping rates for that address. The postal code input should show/hide depending on the selected country. That’s exactly the info we miss.

Kind regards.

1 Like

Hey Francisco,

Thanks for sharing that context. Digging in further here, we do have an open source repository where you can see the rules defined for each country:

Specifically this PR if it helps Require postcodes and update regex in MT by rochlefebvre · Pull Request #354 · Shopify/worldwide · GitHub

Hi @KyleG-Shopify ,

that PR seems to be just something related to latest Malta changes. Anyway, that is far from being an official doc where Shopify clearly documents if zip code is required for each country to use the shipping rates API :slight_smile:

I guess that must be somewhere internally, as you need it to show/hide the zip code input in the checkout.

Just as a proposal, I think that including this info in the GraphQL API should be beneficial for everybody. For example, at: DeliveryCountry - GraphQL Admin. In that object, you provide the country provinces where a shipping can be made. So simply providing a boolean field like “zipCodeRequired” would make sense, from a point of view where the user of this API wants to obtain shipping rates and the “zipCodeRequired” info is absolutely necessary to obtain them.

Thanks,

I agree the API would make it much more accessible and have passed on that suggestion as well.

In the meantime though, that Repo can be used as a source for the mandatory countries. One way you could handle it could be through storing it as metafields.