const productCreate = {
"product": {
"name": productName,
"productType": "physical",
"priceData": {
"price": priceInfo.Value
},
"stock": {
"trackInventory": true,
"quantity": 1
},
"description": productName,
"sku": sku,
"visible": true,
}
};
using this i was able to create the product on my store but the stock part is not working at all it always create the product with the default of
stock: {
trackInventory: false,
inStock: true,
inventoryStatus: 'IN_STOCK'
},
any help ?
The “inStock” and “inventoryStatus” properties are not being set in the “stock” object when creating the product. The “trackInventory” and “quantity” properties are being set, but without “inStock” and “inventoryStatus”, the product is defaulting to the values you mentioned.
Try this to see if it works. I havn’t tested.
const productCreate = {
"product": {
"name": productName,
"productType": "physical",
"priceData": {
"price": priceInfo.Value
},
"stock": {
"trackInventory": true,
"quantity": 1,
"inStock": true,
"inventoryStatus": 'IN_STOCK'
},
"description": productName,
"sku": sku,
"visible": true,
}
};
1 Like
stock: {
trackInventory: false,
inStock: true,
inventoryStatus: 'IN_STOCK'
},
I tried it still same issue
I think that there is an issue from their end or maybe o am doing something wrong but the thing is the product is created and i see it in my store just the inventory part is not tracked
from the document inSttock should be used if the track is manually not automated and that means the inventoryStatus sholuld be used
but i am tracking automatically so I am using the
“trackInventory”: true,
“quantity”: 1,
I even tried this
"stock": {
"trackInventory": true,
"quantity": 1,
"inStock": false,
"inventoryStatus": 'IN_STOCK'
},
still not working and i tried it again without the status still not working
There is a work around it but i really would rather not to use it
the work around is to create a variant that have 1 option ( not a big deal ) and then update the quantity of that variant ( basically it is the 1 product that i want so i won’t add more than 1 option) everything else can stay the same
but this work around will force me to use 3 api calls for each product as i will create then take the product id to query getting the variant id then add the sku to it and then make another api call to update the quantity
so not even 3 it’s 4 calls now
and that will slow my sync a bit due to delays to avoid hitting the rate limit