# inventoryItemUpdate - admin-graphql - MUTATION
Version: 2025-01

## Description
Updates an inventory item.

### Access Scopes
`write_inventory` access scope. Also: The user must have a permission to update an inventory item.


## Arguments
* [id](/docs/api/admin-graphql/2025-01/scalars/ID): ID! - The ID of the inventory item to update.
* [input](/docs/api/admin-graphql/2025-01/input-objects/InventoryItemInput): InventoryItemInput! - The input fields that update an
[`inventoryItem`](https://shopify.dev/api/admin-graphql/latest/queries/inventoryitem).


## Returns
* [inventoryItem](/docs/api/admin-graphql/2025-01/objects/InventoryItem): InventoryItem The inventory item that was updated.
* [userErrors](/docs/api/admin-graphql/2025-01/objects/UserError): UserError! The list of errors that occurred from executing the mutation.


## Examples
### Updates an existing inventory item
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" 
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}"
#### Graphql Input
{
  "id": "gid://shopify/InventoryItem/43729076",
  "input": {
    "cost": 145.89,
    "tracked": false,
    "countryCodeOfOrigin": "US",
    "provinceCodeOfOrigin": "OR",
    "harmonizedSystemCode": "621710",
    "countryHarmonizedSystemCodes": [
      {
        "harmonizedSystemCode": "6217109510",
        "countryCode": "CA"
      }
    ]
  }
}
#### Graphql 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": []
    }
  }
}