Version: 2025-01
Curl example: "curl -X POST \\\nhttps://your-development-store.myshopify.com/admin/api/2025-01/graphql.json \\\n-H 'Content-Type: application/json' \\\n-H 'X-Shopify-Access-Token: {access_token}' \\\n-d '{\n\"query\": \"mutation inventoryItemUpdate($id: ID!, $input: InventoryItemInput!) { inventoryItemUpdate(id: $id, input: $input) { inventoryItem { id unitCost { amount } tracked countryCodeOfOrigin provinceCodeOfOrigin harmonizedSystemCode countryHarmonizedSystemCodes(first: 1) { edges { node { harmonizedSystemCode countryCode } } } } userErrors { message } } }\",\n \"variables\": {\n \"id\": \"gid://shopify/InventoryItem/43729076\",\n \"input\": {\n \"cost\": 145.89,\n \"tracked\": false,\n \"countryCodeOfOrigin\": \"US\",\n \"provinceCodeOfOrigin\": \"OR\",\n \"harmonizedSystemCode\": \"621710\",\n \"countryHarmonizedSystemCodes\": [\n {\n \"harmonizedSystemCode\": \"6217109510\",\n \"countryCode\": \"CA\"\n }\n ]\n }\n }\n}'\n" Node example: "const client = new shopify.clients.Graphql({session});\nconst data = await client.query({\n data: {\n \"query\": `mutation inventoryItemUpdate($id: ID!, $input: InventoryItemInput!) {\n inventoryItemUpdate(id: $id, input: $input) {\n inventoryItem {\n id\n unitCost {\n amount\n }\n tracked\n countryCodeOfOrigin\n provinceCodeOfOrigin\n harmonizedSystemCode\n countryHarmonizedSystemCodes(first: 1) {\n edges {\n node {\n harmonizedSystemCode\n countryCode\n }\n }\n }\n }\n userErrors {\n message\n }\n }\n }`,\n \"variables\": {\n \"id\": \"gid://shopify/InventoryItem/43729076\",\n \"input\": {\n \"cost\": 145.89,\n \"tracked\": false,\n \"countryCodeOfOrigin\": \"US\",\n \"provinceCodeOfOrigin\": \"OR\",\n \"harmonizedSystemCode\": \"621710\",\n \"countryHarmonizedSystemCodes\": [\n {\n \"harmonizedSystemCode\": \"6217109510\",\n \"countryCode\": \"CA\"\n }\n ]\n }\n },\n },\n});\n" Ruby example: "session = ShopifyAPI::Auth::Session.new(\n shop: \"your-development-store.myshopify.com\",\n access_token: access_token\n)\nclient = ShopifyAPI::Clients::Graphql::Admin.new(\n session: session\n)\n\nquery = <<~QUERY\n mutation inventoryItemUpdate($id: ID!, $input: InventoryItemInput!) {\n inventoryItemUpdate(id: $id, input: $input) {\n inventoryItem {\n id\n unitCost {\n amount\n }\n tracked\n countryCodeOfOrigin\n provinceCodeOfOrigin\n harmonizedSystemCode\n countryHarmonizedSystemCodes(first: 1) {\n edges {\n node {\n harmonizedSystemCode\n countryCode\n }\n }\n }\n }\n userErrors {\n message\n }\n }\n }\nQUERY\n\nvariables = {\n \"id\": \"gid://shopify/InventoryItem/43729076\",\n \"input\": {\n \"cost\": 145.89,\n \"tracked\": false,\n \"countryCodeOfOrigin\": \"US\",\n \"provinceCodeOfOrigin\": \"OR\",\n \"harmonizedSystemCode\": \"621710\",\n \"countryHarmonizedSystemCodes\": [{\"harmonizedSystemCode\"=>\"6217109510\", \"countryCode\"=>\"CA\"}]\n }\n}\n\nresponse = client.query(query: query, variables: variables)\n" PHP example: "use Shopify\\Clients\\Graphql;\n\n$client = new Graphql(\"your-development-store.myshopify.com\", $accessToken);\n$query = <<<QUERY\n mutation inventoryItemUpdate($id: ID!, $input: InventoryItemInput!) {\n inventoryItemUpdate(id: $id, input: $input) {\n inventoryItem {\n id\n unitCost {\n amount\n }\n tracked\n countryCodeOfOrigin\n provinceCodeOfOrigin\n harmonizedSystemCode\n countryHarmonizedSystemCodes(first: 1) {\n edges {\n node {\n harmonizedSystemCode\n countryCode\n }\n }\n }\n }\n userErrors {\n message\n }\n }\n }\nQUERY;\n\n$variables = [\n \"id\" => \"gid://shopify/InventoryItem/43729076\",\n \"input\" => [\n \"cost\" => 145.89,\n \"tracked\" => false,\n \"countryCodeOfOrigin\" => \"US\",\n \"provinceCodeOfOrigin\" => \"OR\",\n \"harmonizedSystemCode\" => \"621710\",\n \"countryHarmonizedSystemCodes\" => [{\"harmonizedSystemCode\"=>\"6217109510\", \"countryCode\"=>\"CA\"}],\n ],\n];\n\n$response = $client->query([\"query\" => $query, \"variables\" => $variables]);\n" Remix example: "const { admin } = await authenticate.admin(request);\n\nconst response = await admin.graphql(\n `#graphql\n mutation inventoryItemUpdate($id: ID!, $input: InventoryItemInput!) {\n inventoryItemUpdate(id: $id, input: $input) {\n inventoryItem {\n id\n unitCost {\n amount\n }\n tracked\n countryCodeOfOrigin\n provinceCodeOfOrigin\n harmonizedSystemCode\n countryHarmonizedSystemCodes(first: 1) {\n edges {\n node {\n harmonizedSystemCode\n countryCode\n }\n }\n }\n }\n userErrors {\n message\n }\n }\n }`,\n {\n variables: {\n \"id\": \"gid://shopify/InventoryItem/43729076\",\n \"input\": {\n \"cost\": 145.89,\n \"tracked\": false,\n \"countryCodeOfOrigin\": \"US\",\n \"provinceCodeOfOrigin\": \"OR\",\n \"harmonizedSystemCode\": \"621710\",\n \"countryHarmonizedSystemCodes\": [\n {\n \"harmonizedSystemCode\": \"6217109510\",\n \"countryCode\": \"CA\"\n }\n ]\n }\n },\n },\n);\n\nconst data = await response.json();\n" Graphql query: "mutation inventoryItemUpdate($id: ID!, $input: InventoryItemInput!) {\n inventoryItemUpdate(id: $id, input: $input) {\n inventoryItem {\n id\n unitCost {\n amount\n }\n tracked\n countryCodeOfOrigin\n provinceCodeOfOrigin\n harmonizedSystemCode\n countryHarmonizedSystemCodes(first: 1) {\n edges {\n node {\n harmonizedSystemCode\n countryCode\n }\n }\n }\n }\n userErrors {\n message\n }\n }\n}"
input: { "id": "gid://shopify/InventoryItem/43729076", "input": { "cost": 145.89, "tracked": false, "countryCodeOfOrigin": "US", "provinceCodeOfOrigin": "OR", "harmonizedSystemCode": "621710", "countryHarmonizedSystemCodes": [ { "harmonizedSystemCode": "6217109510", "countryCode": "CA" } ] } }
response: { "data": { "inventoryItemUpdate": { "inventoryItem": { "id": "gid://shopify/InventoryItem/43729076", "unitCost": { "amount": "145.89" }, "tracked": false, "countryCodeOfOrigin": "US", "provinceCodeOfOrigin": "OR", "harmonizedSystemCode": "621710", "countryHarmonizedSystemCodes": { "edges": [ { "node": { "harmonizedSystemCode": "6217109510", "countryCode": "CA" } } ] } }, "userErrors": [] } } }