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.
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.
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
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.
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.