Hello Magento Friends,
Today in this tutorial, I will explain How to Remove SORT BY “Price” Option in Magento 2.
Sort by options is a vital tool for eCommerce websites to increase user convenience in searching the products. It provides a smoother user experience and improves sales conversion rates with improved navigation. Using the sort-by options, users can find their desired product quickly, thereby increasing customer satisfaction and loyalty.
The sort-by options include price, discount, relevance, newest, popularity, and more. In Magento 2, Position, Product Name, and Price are default sort by options. You can easily Add Sort by Price Options in Magento 2.
Due to several reasons, you may not require the sort by price option in Magento 2.
- While selling services, the price may vary. So you want users to ask for price instead of displaying the fixed price.
- For some products, you want the customer’s attention on other crucial features as compared to price.
- If the target audience values other factors more than the price.
Let’s see How to Remove SORT BY “Price” option in Magento 2.
Steps to Remove SORT BY “Price” Option in Magento 2:
Step 1: Create a di.xml file at the below path
And add the following code
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
<plugin name="RemovePriceOption" type="Vendor\Extension\Plugin\Model\Config"/>
Step 2: After that, create Config.php in the following path
And then add the code as follows
public function afterGetAttributeUsedForSortByArray(\Magento\Catalog\Model\Config $catalogConfig, $options)
Ta-da! The SORT BY “Price” option has been successfully removed from your Magento 2 front-end product listing pages.
This way, you can remove the sort by price option in Magento 2. If you need help removing the sort by price option in Magento 2, you can connect with me through the comment section, and I will quickly provide you with the solution.
Share the tutorial with your other Magento friends to help them customize the sort by options in Magento 2. Stay updated with us for more Magento 2 customization solutions.