Building child products

products
child-products

#1

While building child products I am getting the response as:

{
“errors”: [
{
“status”: 409,
“detail”: “Generated slug is non-unique: levismenscasualshirt”
}
]
}

What does that mean. Can you please guide me how to create the child products using variation options.

I am getting product which looks like this:

{
“data”: {
“type”: “product”,
“id”: “00c130d7-dc04-474e-b88e-a76b32835c17”,
“name”: “Levi’s Men’s Casual Shirt”,
“slug”: “levismenscasualshirt”,
“sku”: “0129”,
“manage_stock”: true,
“description”: “100% Cotton\nRegular fit\nShort sleeve\nWash separately inside out or dry clean\nMade in India”,
“price”: [
{
“amount”: 87900,
“currency”: “INR”,
“includes_tax”: true
}
],
“status”: “live”,
“commodity_type”: “physical”,
“meta”: {
“timestamps”: {
“created_at”: “2018-01-11T09:52:25+00:00”,
“updated_at”: “2018-04-05T09:50:25+00:00”
},
“display_price”: {
“with_tax”: {
“amount”: 87900,
“currency”: “INR”,
“formatted”: “Rs879.00”
},
“without_tax”: {
“amount”: 87900,
“currency”: “INR”,
“formatted”: “Rs879.00”
}
},
“stock”: {
“level”: 125,
“availability”: “in-stock”
},
“variations”: [
{
“id”: “b07ef3c5-6748-4a89-999d-18c47131dfbb”,
“name”: “Colour”,
“options”: [
{
“id”: “08ab7e16-6e21-4c52-bae2-cd95be634736”,
“name”: “Blue”,
“description”: “Our most popular color”
},
{
“id”: “3ea71304-1488-4349-8b7f-a3a7ca7be938”,
“name”: “red”,
“description”: “red”
},
{
“id”: “d268e39e-c732-4b5b-8234-cb8230e31fa7”,
“name”: “white”,
“description”: “simple and decent”
},
{
“id”: “5e872b7a-7b9e-42f2-9785-683c1986c202”,
“name”: “black”,
“description”: “dark and decent”
},
{
“id”: “129b992d-1ac1-46d4-86d5-634f3ee82f4b”,
“name”: “pink”,
“description”: “pink”
}
]
},
{
“id”: “934a018e-9980-4c9e-af24-774d38737785”,
“name”: “Size”,
“options”: [
{
“id”: “0a417f24-5f0e-41e4-88f0-61b319a97445”,
“name”: “S”,
“description”: “Small size”
},
{
“id”: “82c3cca1-6b6f-46df-ae30-2f1d081c97e1”,
“name”: “M”,
“description”: “Medium size”
},
{
“id”: “3a475da6-f4c6-4411-b106-572daa42310e”,
“name”: “L”,
“description”: “Large size”
}
]
}
],
“variation_matrix”: {
“08ab7e16-6e21-4c52-bae2-cd95be634736”: {
“0a417f24-5f0e-41e4-88f0-61b319a97445”: null,
“82c3cca1-6b6f-46df-ae30-2f1d081c97e1”: null,
“3a475da6-f4c6-4411-b106-572daa42310e”: null
},
“3ea71304-1488-4349-8b7f-a3a7ca7be938”: {
“0a417f24-5f0e-41e4-88f0-61b319a97445”: null,
“82c3cca1-6b6f-46df-ae30-2f1d081c97e1”: null,
“3a475da6-f4c6-4411-b106-572daa42310e”: null
},
“d268e39e-c732-4b5b-8234-cb8230e31fa7”: {
“0a417f24-5f0e-41e4-88f0-61b319a97445”: null,
“82c3cca1-6b6f-46df-ae30-2f1d081c97e1”: null,
“3a475da6-f4c6-4411-b106-572daa42310e”: null
},
“5e872b7a-7b9e-42f2-9785-683c1986c202”: {
“0a417f24-5f0e-41e4-88f0-61b319a97445”: null,
“82c3cca1-6b6f-46df-ae30-2f1d081c97e1”: null,
“3a475da6-f4c6-4411-b106-572daa42310e”: null
},
“129b992d-1ac1-46d4-86d5-634f3ee82f4b”: {
“0a417f24-5f0e-41e4-88f0-61b319a97445”: null,
“82c3cca1-6b6f-46df-ae30-2f1d081c97e1”: null,
“3a475da6-f4c6-4411-b106-572daa42310e”: null
}
}
},
“relationships”: {
“files”: {
“data”: [
{
“type”: “file”,
“id”: “731571d3-ea82-40cf-8e9d-578a92aefa53”
}
]
},
“categories”: {
“data”: [
{
“type”: “category”,
“id”: “48d688d6-b487-458a-b0b5-fa22ccde038c”
},
{
“type”: “category”,
“id”: “9e49d113-1615-4609-b332-8606f047c68f”
},
{
“type”: “category”,
“id”: “6cf92cfa-afe9-423c-8cec-9975b3351846”
}
]
},
“brands”: {
“data”: [
{
“type”: “brand”,
“id”: “96596e35-e1f0-451a-9346-edfec51f3736”
}
]
},
“variations”: {
“data”: [
{
“type”: “product-variation”,
“id”: “b07ef3c5-6748-4a89-999d-18c47131dfbb”
},
{
“type”: “product-variation”,
“id”: “934a018e-9980-4c9e-af24-774d38737785”
}
]
},
“main_image”: {
“data”: {
“type”: “main_image”,
“id”: “f2c1ae5e-b5eb-4680-9029-c9a4912c15bc”
}
}
},
“size”: “X-Large”,
“material”: “Cotton”,
“sleeve_type”: “Half Sleeve”,
“HDFormat”: null,
“TVFeature”: null,
“displaysize”: null
}
}

I have created and assigned variations to the product.

Can someone help me out


#2

Hi @culeneji-3754yopmai,

As slugs & skus have to be unique for each child product, you’ll need to make sure you add a slug & sku modifier to your options, otherwise the generated child product slugs/skus would clash with the parent.

Modifiers are covered in the API reference and in this blog post.

Thanks,
James


#3

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