Menu Close
    Start a Project Request quote Reading list Switch to dark mode

    How To Add More Sorting Fields in Magento 2

    How To Add More Sorting Fields in Magento 2:- In this blog I’m going to explain how we can add more sorting fields on product collection page or category page.

    In order to add more sorting fields you need to follow below steps.

    Step 1: Make plugin of Class Magento\Catalog\Model\Config and Magento\Catalog\Block\Product\ProductList\Toolbar  by defining it’s entry in di.xml.

    So, lets create a di.xml file in app/code/Vendor/ModuleName/etc directory and write below code..

    Step 2: Create Config.php file under app/code/Vendor/ModuleName/Plugin directory and write below code.

    This will add a new sorting field.

    Step 3: Create Toolbar.php file under Vendor\ModuleName\Plugin\Product\ProductList directory and write below code.

    In this way we can add custom sorting fields as per our requirement.. hope it will be helpful for you. 🙂

    If you will face any issue then comment below.


    . . .


    Add Your Comment

    Be the first to comment.

    Back to Top
    Hire Us!
    Brief us about your requirements and we'll get back to you.
    Woo! Hooy!
    We have just recieved your project brief and our expert will contact you shortly.
    Send Again