I have multi-select attribute name location like : Delhi , Maharashtra, Karnataka.

I want to use sort by of filter by in such way when I use above filter / sort it should show all products but product with matching attributes should show on top.

for example if I am using filter/sort with value as Maharashtra all products should show on listing page but products with value Maharashtra will be on top .

I can not find any way to do same please help with it how can it be done.

  • Have you created attribute ?
    – Pawan
    Oct 25, 2019 at 3:47
  • yes we have created attribute Oct 25, 2019 at 10:50
  • just like position, name and price work ?
    – Pawan
    Oct 25, 2019 at 16:50
  • @Pawan can u help with issue Nov 1, 2019 at 16:08
  • will try, do you want same as position and name work in sort option ?
    – Pawan
    Nov 1, 2019 at 17:06

2 Answers 2


You have to override listing page product collection block. Separately get collection of products base on location, then append both collections.


Create New Product Attribute: In the tab: Properties Default Label: Location Catalog Input Type for Store Owner: Dropdown OR Multiple Select Values:add your location

Storefront properties: Use in Layered Navigation: Filterable(with result)

After assign this attribute to product set and run: php bin/magento c:f

Finally in category page showing.

  • please read my question is bit different Oct 25, 2019 at 12:43

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.