Order Create API - Province issue

Solved
Highlighted
Tourist
4 1 0

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.

0 Likes
Highlighted
Shopify Staff (Retired)
Shopify Staff (Retired)
624 103 124

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"

 

Hassain | Developer Support Specialist @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Click Accept as Solution 

0 Likes
Highlighted
Tourist
4 1 0

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. 

0 Likes