Unable to control inventory tracking using productSet mutation

This is fantastic, thank you so much.

I see it in the docs, and also in this update from the 15th:

1 Like

I think this is the same type of issue I’m having. Using productSet to bulk import via the API products without options I could not set the inventory tracking status. One try led to another and while I can do it now, it requires a place holder for the import to work:

{
“input”: {
“title”: "Cool Album ",
“tags”: “Music, Records”,
“productType”: “Music”,
“giftCard”: false,
“status”: “ACTIVE”,
“productOptions”: [
{
“name”: “Default”,
“position”: 1,
“values”: [
{
“name”: “Default Value”
}
]
}
],
“variants”: [
{
“price”: 15.99,
“sku”: “dhcoldwar”,
“inventoryItem”: {
“tracked”: true,
“measurement”: {
“weight”: {
“value”: 16,
“unit”: “OUNCES”
}
}
},
“inventoryQuantities”: {
“locationId”: “gid://shopify/Location/999999”,
“name”: “available”,
“quantity”: 1
},
“optionValues”: [
{
“optionName”: “Default”,
“name”: “Default Value”
}
]
}
],
“files”: [
{
“filename”: “dhcoldwar.jpg”,
“contentType”: “IMAGE”,
“duplicateResolutionMode”: “REPLACE”,
“originalSource”: “https://www.example.com/store/catalog/products/lp/dhcoldwar.jpg
}
],
“metafields”: [
{
“namespace”: “custom”,
“key”: “idProduct”,
“value”: “352211”,
“type”: “single_line_text_field”
}
]
}
}
When I added the “variants” section, then the error stated something else was missing… so I added it.

As you can see, I have info under “variants”, but when you preview the product it has one default option - which doesn’t seem correct.

If someone could simply provide an example of how I can get price, sku, inventoryItem, inventoryQuantities to import without creating a single option product for a standard type of product I would appreciate it!

@Kevin_Cook I don’t really know if that’s related to this issue, but for your problem, it’s normal to still work with variants even if you don’t have any options, because by default there is a single variant with option name “Title” and value “Default title”. So maybe if you use those values for the option name and value it will work as expected. Or maybe it doesn’t matter what values you use.

I guess I’m used to not seeing a single option shown if it’s a standard product that has no options.

For example, I found this on a shopify site, no options:


I realize that I could go into the product via at admin and set these values, but I have over 9k products.

I also realize that I could make additional calls to update these - but shouldn’t I be able to do this when initially creating the product using productSet?

Yes, that’s what I’m saying, I think you need to use “Title” for the option name, and “Default Title” for the option value. Shopify uses these values for all products by default, and that should make the options hidden.

No joy. The error I get back is “Option does not exist”.

Actually, if did! I have a monster storedproc that builds the json and I had to update it in two places. You’re a genius Sir.

1 Like