Solved

Order Create API - Province issue

bdozonos
Shopify Partner
10 1 2

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.

Accepted Solution (1)
bdozonos
Shopify Partner
10 1 2

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. 

View solution in original post

Replies 2 (2)

hassain
Shopify Staff (Retired)
624 104 187

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.

bdozonos
Shopify Partner
10 1 2

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.