[REST API] Create Products with multiple variation combinations
-
Hi all,
I’m trying to create products from a 3rd party source using the REST API and all works well except when it comes to variations. I can get single variations to work, but not combinations of variations.
The process I am following is:
1. Create Attributes
2. Create Attribute Terms
3. Create Product
4. Add attributes to product
4. Add variations based on AttributesFor a product with a single variation, this works fine (for example, size: small, medium, large).
Using the API docs, this looks like:
“regular_price”: “9.00”,
“image”: {
“id”: 423
},
“attributes”: [
{
“id”: 6,
“option”: “Black”
}
]
}’However, if I have multiple variations – for example size & colour, I cannot figure out how to add the variations through the API (small/blue, small/black, small/red, medium/blue, medium/black, medium/red etc).
I understand that each attriubute combination has to be a seperate variation – so a variation for:
small/blue
small/black
small/red
medium/blue
medium/black
etc.But how to I submit this info in the API?
“regular_price”: “9.00”,
“image”: {
“id”: 423
},
“attributes”: [
{
“id”: 6, <— tried this as an array of the approrpiate attributes (size, colour)
“option”: “Black” <— also set this as an array of option values
}
]
}’I’ve searched for examples or others trying to do something similar, but have had no success.
Anyone any suggestions?
- The topic ‘[REST API] Create Products with multiple variation combinations’ is closed to new replies.