Forum

Thread tagged as: Question, Shop

Product Variant Sorting

Hi, so I used perch_shop_product_variants() to output all variants of my product. As an example the products would be laid out like:

Product1 - Blue, small
Product2 - Blue, medium
Product3 - Blue, Large
Product4 - Red, small
Product5 - Red, medium
Product6 - Red, Large

What I'm trying to accomplish is lay them out like:

Product1 - small, blue
Product2 - small, red
Product3 - medium, blue
Product4 - medium, red
Product5 - large, blue
Product6 - large, red

Is there any way to lay this out like this? I cannot seem to find a way. I changed the precedence (size now '2' and color '1') and this did not change. Any suggestions?

Jared Dutra

Jared Dutra 0 points

  • 3 years ago

Jared, I think this is defined by the template your using to output the product and variants.

What does your template look like?

For some reason I am thinking the precedence order has to do with the order you see the options in the Perch Shop Admin Panel, not the actual output on the front end.

RK

Drew McLellan

Drew McLellan 2638 points
Perch Support

Have you regenerated the variants since changing the precedence? (Obviously not something you want to do with live products.)

That fixed it. I deleted the variants and regenerated them. Thanks Drew.