All things Shopify and commerce
I'm adding products with the productSet Mutation and then trying to update inventory with the ActivateInventoryItem mutation
I'm trying to enable inventory tracking and set the inventorytracker to shopify but I don't see any way to do this.
The ActivteInventoryItem mutation doesn't create any errors but also seems to be completely ignored by the system since none information included in the mutation exists after running the mutation
See mutation below:
mutation ActivateInventoryItem($inventoryItemId: ID!, $locationId: ID!, $available: Int) {
inventoryActivate(inventoryItemId: $inventoryItemId, locationId: $locationId, available: $available) {
inventoryLevel {
id
quantities(names: ["available","on_hand"]) {
name
quantity
}
item {
id
tracked
}
}
}
}
{
"inventoryItemId":"gid://shopify/InventoryItem/" + productInventoryID,
"inventoryItemTracked":"true",
"locationId":gidLocation,
"available":11,
"onHand":11
}
Solved! Go to the solution
This is an accepted solution.
The issue likely lies in how the Shopify API handles inventory tracking and inventory updates. Here's a breakdown of your situation and how to address it:
To enable inventory tracking for an item, you need to ensure the inventory item is associated with a location and has tracking enabled. This requires a combination of the inventorySet mutation (to enable tracking) and inventoryActivate mutation (to activate the inventory at a location).
Enable Inventory Tracking: Use the inventorySet mutation to update the inventory tracking of your product. Example mutation:
Variables:
Associate Inventory with a Location: Use the inventoryActivate mutation to set up the inventory at a specific location.
Variables:
Ensure the locationId corresponds to a valid location in your Shopify store. You can query available locations using:
Ensure productInventoryID is correctly retrieved when creating the product. You can confirm it by querying the product details:
This is an accepted solution.
The issue likely lies in how the Shopify API handles inventory tracking and inventory updates. Here's a breakdown of your situation and how to address it:
To enable inventory tracking for an item, you need to ensure the inventory item is associated with a location and has tracking enabled. This requires a combination of the inventorySet mutation (to enable tracking) and inventoryActivate mutation (to activate the inventory at a location).
Enable Inventory Tracking: Use the inventorySet mutation to update the inventory tracking of your product. Example mutation:
Variables:
Associate Inventory with a Location: Use the inventoryActivate mutation to set up the inventory at a specific location.
Variables:
Ensure the locationId corresponds to a valid location in your Shopify store. You can query available locations using:
Ensure productInventoryID is correctly retrieved when creating the product. You can confirm it by querying the product details:
The UpdateInventoryItem mutation let me enable inventory tracking.
The ActivateInventoryItem mutation still doesn't do anything but I can set the initial inventory quantity in the productSet mutation so I will just stop using ActivateInventoryItem
Thank you
Hey Community! As the holiday season unfolds, we want to extend heartfelt thanks to a...
By JasonH Dec 6, 2024Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024