One product has multiple attributes, each combination represent an individual product. As you add variable products with variations in woocommerce (WordPress).
Now I've product attributes in array and confused how can I create multiple drop downs based on multiple categories.
array:3 [▼
0 => array:3 [▼
"id" => 13
"name" => "size"
"value" => "small"
]
1 => array:3 [▼
"id" => 14
"name" => "size"
"value" => "large"
]
2 => array:3 [▼
"id" => 19
"name" => "color"
"value" => "white"
]
]
As index 0, 1 has same name "Size" having different values, so it should display in a one dropdown and other one should display on another drop down.
I know my logic is wrong here to print out drop downs can you guys help me ?
<select class="form-control" id="attribute" name="attribute[]" style="width:70%;">
@foreach($attributes as $attribute)
<option value="">Select {{ $attribute->name }}</option>
<option value="{{ $attribute->id }}">{{ $attribute->value }}</option>
@endforeach
</select>
Thanks,