PLEASE HELP: Adding "Country/Region of Origin" when creating new items using the API .json requests.

pyIcarus
New Member
1 0 0

Hello everyone,

 

I'm trying to add a new product to an online store utilizing the API calls and while making the POST /products.json I'm able to set every parameter except the country/region of origin field. Here's what my JSON call looks like:

 

{
                "product":{
                    "title":"test title",
                    "body_html":"test body",
                    "product_type":"test type",
                    "vendor":"test vendor",
                    "tags":['tt1', 'tt2', 'tt3'],
                    "published_at":None,
                    "images":img,
                    "variants":[
            {
                "price":"10.50",
                "compare_at_price":"15.80",
                "cost":"3.33",
                "taxable":True,
                "sku":"ABC123",
                "barcode":"BARBARBAR",
                "weight":"0.3",
                "weight_unit":"g",
                "inventory_management":"shopify",
                "inventory_policy":"continue",
                "fulfillment_service":"manual",
                "inventory_quantity":"10",
                "option":None,
                "present_prices":None,
                "country_code_of_origin": "US"
            }
        ],
                    "status":self.status,
                    "published":self.published,
                }
            }
0 Likes
_JCC_
Shopify Staff
Shopify Staff
66 10 9

@pyIcarus ,

Happy to help you out with this.

The country_code_of_origin is updated via the inventory_item endpoint for REST, and for GraphQL using the inventoryItemUpdate mutation.

The result of your product creation call will return an inventory_item_id for each variant created, that can be used to update the country of origin.

I Hope this helps, if you have any questions please don't hesitate to reply.

Regards,

John

 

 

John C | Developer Support @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

0 Likes