i have configurable and simple product in my website with Attribute color: (Values - Red, Green, Blue)

I want to sort product on the listing page with specific attribute value, for example, all product having red as color should show first then rest of products.

I could not get any way to get this done


1 Answer 1


Well this kind of breaks the idea of sorting from a UX standpoint. When you sort something, you are assessing a value of an attribute in a descending or ascending direction (say price, name, position, etc) AND NOT consider other attributes like color, manufacturer, etc in the process.

From my understanding, what you are trying to do is a 'promotion' of some products in front of the others in a listing, regardless of the actual sorting chose by the customer. So basically you are breaking the product list in 2 - first with the promoted products and the remaining list afterwards. But this needs a lot of heavy customizations as you have to manage the proper inclusion and exclusion of IDs retrieved by Elasticsearch and then at display level too (pagination and so on).

However, things can get simplified if you settle for a compromise - show the red products first by setting the appropriate position in category so that they show up first, then set the default category sorting to be by 'Position'. This will achieve your requirement when the user first enters the category, but if s/he changes the sorting criteria, then the products will obey the new sorting criteria.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.