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.
Let’s see How to Remove SORT BY “Price” option in Magento 2.
Step 1: Create a di.xml file at the below path
app\code\Vendor\Extension\etc\
And add the following code
<?xml version="1.0"?> <config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd"> <type name="Magento\Catalog\Model\Config"> <plugin name="RemovePriceOption" type="Vendor\Extension\Plugin\Model\Config"/> </type> </config>
Step 2: After that, create Config.php in the following path
Vendor\Extension\Plugin\Model\
And then add the code as follows
<?php namespace Vendor\Extension\Plugin\Model; class Config { public function afterGetAttributeUsedForSortByArray(\Magento\Catalog\Model\Config $catalogConfig, $options) { unset($options['price']); return $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.
Happy Coding!
E-commerce has transformed the way consumers shop for products and services and interact with businesses.…
The e-commerce world is constantly in flux. New tech and strategies emerge daily to help…
Hello Magento Friends, In today’s blog, we will discuss adding a header and footer to…
Hello React Native Friends, Building a visually appealing and responsive mobile app is crucial in…
We're thrilled to announce the release of Hyvä Themes 1.3.6 and 1.3.7! These latest updates…
Your e-commerce platform is surging - orders are rolling in, traffic spikes are becoming the…