I am running the inventoryActivate endpoint and I am getting a code 200 on it.
On the respective product page, I see that its not enabling the tracking of that product:
When I click on the Track Quantity field the information is then shown:
I remember the old request did this automatically. My questions are the following:
- Is there an endpoint for me to do this using an API and not to log into Shopify to do
- If there is another way of doing this programatically
AMaL
2
Use the field tracked in the inventoryItem: sample query
{
"synchronous": true,
"productSet": {
"title": "Wintger hat",
"productOptions": [
{
"name": "Color",
"position": 1,
"values": [
{
"name": "Grey"
},
{
"name": "Black"
}
]
}
],
"variants": [
{
"inventoryItem":{
"tracked": true
},
"optionValues": [
{
"optionName": "Color",
"name": "Grey"
}
],
"price": 79.99
},
{
"optionValues": [
{
"optionName": "Color",
"name": "Black"
}
],
"price": 11.99
}
]
}
}
you can use mutation productVariantsBulkUpdate
mutation {
productVariantsBulkUpdate(
productId: "gid://shopify/Product/123456789",
variants: [
{
id: "gid://shopify/ProductVariant/987654321",
inventoryItem: {
tracked: true
}
},
{
id: "gid://shopify/ProductVariant/987654322",
inventoryItem: {
tracked: true
}
}
]
) {
productVariants {
id
inventoryItem {
tracked
}
}
userErrors {
field
message
}
}
}