I want to create product variations like this image:
I have tried with static data it works.
$collection = collect(["XL", "XXL"]);
return $collection->crossJoin(["1kg", "2kg"], ["Red", "Green"]);
But I want to create this dynamically. I have tried this way.
$collections = [];
foreach ($request->options as $key => $option) {
if($key == 0) continue;
array_push($collections, $option["option_values"]);
}
return $collection->crossJoin($collections);
Its return like this image.That is not exact I want. I figured out problem that is $collections is a new array and option values inside this array. So that it's return like this. But I can not solve this problem.
I have dd my request data.