I have a product form which I would like users to add variants of this product to. My object for the main settings
{
title: \'Bike\',
settings: {
opt
Try this:
generateVariants() {
const options = [...this._form.settings.options];
const sizeOptions = options[0].values;
const colorOptions = options[1].values;
const regeneratedVariants = [];
for(let i=0;i< sizeOptions.length;i++) {
for(let j=0;j< colorOptions.length;j++) {
regeneratedVariants.push({
Size: sizeOptions[i],
Color: colorOptions[i],
Image: "img.png"
})
}
}
console.log(regeneratedVariants);
}
this will produce an array with all the variants possible with sizes and colors.