Discussing APIs and development related to customers, discounts, and order management.
Im trying to submit an international order through the order create api end point and the shipping/billing address is not coming through.
After digging into it it seems that having a blank "Province" in the address is causing the address validation to fail even though according to this post Order-API-Address-Validation-Updates I should not have to provide province and the country 'Gibraltar' does not have a province/state.
If I force province to be just a '-' then the order imports but this a hacky workaround for a problem that shouldn't exist especially considering if I create an order through shopify's front end checkout I do not need to provide a province for Gibraltar and it does import with an empty city and province.
Solved! Go to the solution
This is an accepted solution.
Thanks for the response!
It seems even passing in 'province' as null still causes the address validation in the order create to fail.
I had to completely remove the province field from the request all together for it go through and populate the address in the order.
Hey @bdozonos ,
For cases like the one you described (i.e. Shipping to a country like Gibraltar which has no provinces) you can simply leave the fields of "province" and "province_code" as set to `null`. You should not receive an error from Shopify or the Order API Address Validation by doing this - the only fields that are required by the Order API Address Validation are the customer's last name, address line 1, city, and country. So you should have no issue with making an order that ships to a location like Gibraltar as long as you set both the city and country to "Gibraltar"
To learn more visit the Shopify Help Center or the Community Blog.
This is an accepted solution.
Thanks for the response!
It seems even passing in 'province' as null still causes the address validation in the order create to fail.
I had to completely remove the province field from the request all together for it go through and populate the address in the order.