Is it possible to apply sorting option and direction at the same time, using sorting select box?
The sorting select box could have options like:
- Price Asc
- Price Desc
- Position Asc
- Position Desc
- ..
magento2sorting
Is it possible to apply sorting option and direction at the same time, using sorting select box?
The sorting select box could have options like:
Best Answer
You can follow the steps describe below to achieve this customization task.
I assume you are using a custom theme "Vendor_theme" .
step 1) create the file sorter.phtml
under
/app/design/frontend/Vendor/theme/Magento_Catalog/templates/product/list/toolbar
File : sorter.phtml
step 2: create the file requirejs-config.js
under
/app/design/frontend/Vendor/theme/Magento_Catalog
File : requirejs-config.js
step 3: create the file toolbar-mixin.js under /app/design/frontend/Vendor/theme/Magento_Catalog/web/js/product/list
File: toolbar-mixin.js
step 4:: Run below commadn from Magento root to remove static files and cache.