A space to discuss GraphQL queries, mutations, troubleshooting, throttling, and best practices.
Hello,
I am trying to create a product with few variants and assign them (Harmonized System) HS code and Country of origin. According to this article https://shopify.dev/changelog/the-inventoryitem-resource-now-includes-hs-codes-country-codes-and-pro... HS code should be a product variant metafield. I was unable to find how to specify country of origin just found that inventory item may have them https://shopify.dev/api/admin-rest/2022-01/resources/inventoryitem so tried to try my luck and do something similar for product variant but it doesn't work. Strangely enough but HS code also doesn't work correctly: the metafield is there, I can see it in a browser after adding an item:
and the "harmonized_system_code" metafield looks pretty similar when I'm adding HS code to a blank item using web admin:
Even more: when I'm opening in web admin the product variant with imported HS code metafield it shown no HS code but if I'll put there HS code and save changes the metafield will be updated with the value I set in web admin.
Here is the REST request:
{
"product": {
"title": "Regular T-Shirt Heather Grey",
"body_html": "<p>The Regular T-Shirt from Japanese based brand Sheltech</p>",
"vendor": "SHELTEC",
"product_type": "T-Shirts",
"published_at": "2020-10-29T17:54:27",
"published_scope": "global",
"tags": ["Sub-category:Long Sleeve Tees","Sub-category2:Round Neck","Season:SS20","Colour:Grey","Department:Menswear","Country:Japan","Material:Leather","Brand:SHELTEC","Men"],
"variants": [
{
"option1": "Size M Color Grey",
"price": "45",
"inventory_management": "shopify",
"weight": 1,
"weight_unit": "kg",
"metafields": [
{"key":"harmonized_system_code","value":"070110","type":"string","namespace":"global"},
{"key":"country_code_of_origin","value":"JP","type":"string","namespace":"global"},
{"key":"country_code","value":"JP","type":"string","namespace":"global"}
],
"sku": "11951M",
"barcode": "11951"
},
{
"option1": "Size L Color Grey",
"price": "45",
"inventory_management": "shopify",
"weight": 1,
"weight_unit": "kg",
"metafields": [
{"key":"harmonized_system_code","value":"070110","type":"string","namespace":"global"},
{"key":"country_code_of_origin","value":"JP","type":"string","namespace":"global"},
{"key":"country_code","value":"JP","type":"string","namespace":"global"}
],
"sku": "11952L",
"barcode": "11952"
},
{
"option1": "Size XL Color Grey",
"price": "45",
"inventory_management": "shopify",
"weight": 1,
"weight_unit": "kg",
"metafields": [
{"key":"harmonized_system_code","value":"070110","type":"string","namespace":"global"},
{"key":"country_code_of_origin","value":"JP","type":"string","namespace":"global"},
{"key":"country_code","value":"JP","type":"string","namespace":"global"}
],
"sku": "11953XL",
"barcode": "11953"
}
],
"status": "test"
}
}
Solved! Go to the solution
This is an accepted solution.
Yes. Actually by some reason Shopify stores HSC and country of origin over inventory items not products. You can use PUT request as it's shown here: https://shopify.dev/docs/api/admin-rest/2024-10/resources/inventoryitem#put-inventory-items-inventor...
Just came across this when looking in to something myself. Did you get to the bottom of the problem in the end and what was the solution?
This is an accepted solution.
Yes. Actually by some reason Shopify stores HSC and country of origin over inventory items not products. You can use PUT request as it's shown here: https://shopify.dev/docs/api/admin-rest/2024-10/resources/inventoryitem#put-inventory-items-inventor...