How to add stock to child products created by variations


#1

When i add child product to cart the response is 400 status error
{
“errors”: [
{
“status”: 400,
“title”: “Stock Unavailable”,
“detail”: “You do not have enough stock to fulfill this request”
}
]
}

By default stock is empty when child products are build, below data is one of the child product
{
“data”: {
“type”: “product”,
“id”: “36937006-e9f1-449a-9004-a4f310853a0e”,
“name”: “Pepe Jeans Men’s Checkered Slim Fit Cotton Casual Shirt”,
“slug”: “PepeJeans-blue-small”,
“sku”: “0138-blue-S”,
“manage_stock”: true,
“description”: “Cotton Blend\nRegular Fit\nRed\nCheckered\nGentle Machine Wash As Per Tag”,
“price”: [
{
“amount”: 89900,
“currency”: “INR”,
“includes_tax”: true
}
],
“status”: “live”,
“commodity_type”: “physical”,
“relationships”: {
“categories”: {
“data”: [
{
“type”: “category”,
“id”: “48d688d6-b487-458a-b0b5-fa22ccde038c”
},
{
“type”: “category”,
“id”: “b9620b87-70bb-4e9c-82f3-d666c9a66d80”
},
{
“type”: “category”,
“id”: “6cf92cfa-afe9-423c-8cec-9975b3351846”
}
]
},
“brands”: {
“data”: [
{
“type”: “brand”,
“id”: “18b743c4-dbb5-49fc-b6cf-f4245d42543c”
}
]
},
“parent”: {
“data”: {
“type”: “product”,
“id”: “c2a40864-0b79-4120-8532-5c956d52c911”
}
}
},
“meta”: {
“display_price”: {
“with_tax”: {
“amount”: 89900,
“currency”: “INR”,
“formatted”: “Rs899.00”
},
“without_tax”: {
“amount”: 89900,
“currency”: “INR”,
“formatted”: “Rs899.00”
}
},
“stock”: {
“level”: 0,
“availability”: “out-stock”
},
“variation_matrix”: []
},
“size”: null,
“material”: null,
“sleeve_type”: null,
“HDFormat”: null,
“TVFeature”: null,
“displaysize”: null
}
}

How can I add the stock for child products so that item can be added to cart


#2

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.


#3