How to update the 'tracked' and 'country_code_of_origin' fields on an InventoryItem?

Anthony_MacKay
Shopify Partner
2 0 0

Hi - can anyone provide a sample JSON message that I can use to update the 'tracked' and 'country_code_of_origin' fields on the InventoryItem for a ProductVariant?

I'm currently sending this:

{
"inventory_item": {
"id": 29617460805709, //inventory item ID from variant
"tracked": False,
"country_code_of_origin": "US",
}
}

 

I'm PUT'ing that to https://username:password@store-name.myshopify.com/admin/inventory_items/#29617460805709.json (with the username, password, and store name filled in).

 

But I'm getting HTML back for some reason. Am I able to update these fields in this way, or do I have to do something else? There don't seem to be any examples of this in the documentation. Thanks!

Replies 3 (3)
Anthony_MacKay
Shopify Partner
2 0 0
Alan_TuxtonHome
New Member
1 0 0

Hi Anthony,

 

I just figured it out myself. I'm using python API but here's the snippet of my code

shopify.InventoryItem(dict(id=InventoryItemID, tracked=True)).save()
Ben_Incani
Shopify Partner
1 0 0

Im using the "inventory_management" field in the variants to "track" the stock on product creation.

    "variants": [
        {
            "sku": "lgfs231214906l",
            "option1": "l",
            "price": "119.00",
            "inventory_management": "shopify"
        },

 

country_code_of_origin does not work and is being updated later using a put on the InventoryItem.