I am building a Woocommerce site, and the client is going to sale headphones. Each headphone will have multiple colors. In the product’s index page he wants to display all product variations instead of 1 headphone.
For example, If i create 1 product and add the variations (color), in the index there will be 1 product, and I will be able to choose a variation in the product detail page.
But I could also create one category, let’s say ‘headphones’ and add each color as a single product and loop through that category to display the same product multiple times just with different colors.
What would be the best approach for this, and if the best approach is to create one single product with color variations, how do I loop through the variations in order to display each single color in the product’s index?
Maybe it could do what you’re askin’. Hope it helps
I made that way:
Where ‘pa_variacao’ is ‘pa_’ the woocommerce prefix for the custom product variation and ‘variacao’ is the slug to the custom variation, the
<li>
is the way that I used to show the variations on my shop.