Unable to create order via Shopify API with country set to Singapore

Highlighted
New Member
2 0 1

Part of our app creates orders in a retailer's store via Shopify's API. We ran into a case today where an order is failing to create because the Shopify API says the billing and shipping address country can't be blank. The data we're sending to the API does indeed have a country specified:

{ "billing_address": { "province": "Singapore", "city": "Singapore", "name": "-- --", "zip": "-----", "address1": "--------", "address2": "-----", "phone": "-", "country": "Singapore" }, "billing_address": { "province": "Singapore", "city": "Singapore", "name": "-- --", "zip": "-----", "address1": "--------", "address2": "-----", "phone": "-", "country": "Singapore" } } No matter what I send the API, it responds with: {"errors":{"billing_address":["Country can't be blank"],"shipping_address":["Country can't be blank"]}} Am I missing something?
0 Likes
Explorer
41 0 15

I am currently facing a similar issue:

 

1. I notice that there is now a field called 'country_name':

    "order" : {
        "billing_address" : {
            "zip" : "48025-2205",
            "first_name" : "xxx",
            "country" : "United States",
            "last_name" : "xxx",
            "province_code" : "MI",
            "country_name" : "",

...

        "shipping_address" : {
            "zip" : "48025-2205",
            "first_name" : "xxx",
            "country" : "United States",
            "last_name" : "xxx",
            "province_code" : "MI",
            "country_name" : "",

Try adding this field and including the country again.

 

Also see this thread which implies that if a country is not set up in the Shipping Preferences, you cannot create an order for it with the API (I have not verified this myself):

https://ecommerce.shopify.com/c/shopify-apis-and-technology/t/can-t-create-an-order-with-shipping-ad...

 

0 Likes
Explorer
41 0 15

Update:
As per the thread I mentioned, if the country isn't enabled in your shipping methods for your store, it seems to give this error. 
As that thread points out, if you are creating an order through the API, it shouldn't matter whether shipping is enabled to that country or not.

0 Likes
New Member
5 0 0

Weirdly in my case where I was getting the error I needed to add a Shipping Zone for the Billing Address (used Rest of World) country where as the Shipping Address had a supported country.

Bug?

0 Likes
Explorer
41 0 15

If that's true, then I would say that's a bug. Have a think about reporting it to Shopify and asking them to create a bug report

0 Likes