Sometimes you might see sorting or menu order issues with single variations in WooCommerce. We will explain you how this issue was solved in our single variations plugin.
By default WooCommerce is sorting products by a field called “menu_order”. An example:
- T-Shirt -> 1
- Hoodie -> 2
- Cap -> 3
You can change this default sorting in WooCommerce > Products > Sorting. Here you can drag and drop products to have them in the menu order you like them to.
Variations however are custom post types with an own menu_order field. So for example:
- T-Shirt -> 1
- T-Shirt Blue > 1
- T-Shirt Red > 2
- T-Shirt Yellow > 3
- Hoodie -> 2
- Hoodie Blue > 1
- Hoodie Red > 2
- Hoodie Yellow > 3
- Cap -> 3
- Cap Blue > 1
- Cap Red > 2
- Cap Yellow > 3
You might see the issue now here: In category or listing pages your products are totally messed up, because T-Shirt Blue has the same sorting as Hoodie and Cap Blue:
- T-Shirt Blue > 1
- Hoodie Blue > 1
- Cap Blue > 1
- …
To solve this issue we added an option to inherit or override the single variation menu order with the parent variable one.
After activating, the new listing will look like this
- T-Shirt -> 1
- T-Shirt Blue > 1
- T-Shirt Red > 1
- T-Shirt Yellow > 1
- Hoodie -> 2
- Hoodie Blue > 2
- Hoodie Red > 2
- Hoodie Yellow > 2
- Cap -> 3
- Cap Blue > 3
- Cap Red > 3
- Cap Yellow > 3
So in your category listings you will first see all T-Shirts, then Hoodies and then Caps. When this was not enabled before do a reset and init again.
This solution has one drawback: you can no longer sort variations on single products (for whatever reason you want to do anyway).
If you require to sort single variation on product level and you can live with a mixed listing / category sorting just turn the option in our plugin settings off.