If you are running an online store, you will see that there are some specific cases in which you need to put an item on the product page without allowing customers to directly purchase this item. In this case, you will need to hide the Add to cart button on the product page to avoid selling the product. Although Magento administration can programmatically hide or disable the Add to cart button, there are also many available extensions to manage this task without any difficulty.
In this article, we will provide you with detailed steps on how to hide/disable Add to cart button in Magento 2.
Table of Contents
I. Why we need to hide/disable the Add to Cart button
There are some particular circumstances that store owners should display products without the Add to cart button. Hide or disable the Add to cart button in Magento 2 will be a smart choice if:
- Your store is still working on a product or service, but you want to display this product for SEO and marketing benefits. At that time, the upcoming product still attracts customers to the product page and your stores can advertise new items easily.
- These products are temporarily out-of-stock, so your shop has to stop selling them at the moment. By removing the Add to cart button, customers are unable to buy products, but they can acknowledge these items and come back the next time to purchase them.
- There are some items that are not for sale. Customers can view the product details and features to make comparisons, but your store doesn’t offer these products.
II. How to hide/disable the Add to Cart button
Step 1: Create di.xml file in Vendor\Module\etc and copy the below code
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="/lib/internal/Magento/Framework/ObjectManager/etc/config.xsd"> <type name="Magento\Catalog\Model\Product"> <plugin name="hidebutton" type="Vendor\Module\Plugin\HideButton" sortOrder="10" disabled="false" /> </type> </config>
Step 2: Create HideButton.php file in Vendor\Module\Plugin and copy the code below.
<?php namespace Vendor\Module\Plugin; use Magento\Catalog\Model\Product; class HideButton { public function aroundIsSalable(Product $product,\Closure $result) { return 0; } }
Step 3: Run php bin\magento cache:clean and refresh the page.
Now, the Add to cart button of all products which are filed under the associated category will be hidden. You have finished hide or disable the Add to cart button.
III. List of extensions to hide/disable Add to cart button in Magento 2
Rather than programmatically hide or disable the Add to cart button in Magento 2, store owners can also implement a Magento 2 extension having this feature. There are many Magento 2 Hide price or Call for price extensions providing additional features in the market that you can install to your store.
Hide Price/Call for Price extension is essential for all B2B and B2C businesses, as it is a smart weapon to hide the Add to cart weapon and replace it with diverse call-to-action messages for not logged-in visitors or guests. More than that, this extension also encourages customers to take further actions such as registering or upgrading the customer group and enjoy more competitive advantages at your store.
Here is a list of extensions having the hide/disable Add to cart feature that you can make use of:
Brands | Products | Main features | Price | Detail links |
Landofcoder | Magento 2 Hide Price Extension | Magento 2 Hide Price Extension is a smart solution for both B2B & B2C business! Supporting a basic, easy-to-config function to hide & manage price display based on the customer groups, Magento 2 Hide Product Price customizes the " Add to Cart" button with diverse call-to-action messages for not logged in visitors or the guests.
and more | $128 | DC10FAE | -10% |
Amasty | Call for Price for Magento 2 | Replace the "Add to cart" with flexible options. Place a link with redirection or an image instead of the button. Select the group of customers and particular categories to display the 'Call for price' button to. Easily engage customers into more activity, asking to sign up and provide more feedback.
and more | $169 | |
Mageplaza | Call For Price by Mageplaza | Magento 2 Call For Price supports e-commerce shop owners to manage the product price visibility. Call For Price is useful to specific purposes that push buyers to contact to store as well as hide product prices effectively.
and more | $129 | |
Bsscommerce | Call For Price by Bsscommerce | More and more merchants choose Magento platform to launch their wholesale stores due to its rich features. Still, there are lots to improve. Under B2B Category, this Magento 2 Call for price is among the best-sellers. The feature list is the combination of the basic hide price and advanced ask for price function.
and more | $119 | |
Magecomp | Magento 2 Hide Price | Magento 2 Hide Price extension hides product price and add to cart button for not logged in customer and specific customer groups.
and more | $49 | |
Meetanshi | Magento 2 Call for Price | Magento 2 Call for Price extension by Meetanshi allows store owners to hide product prices and "Add to Cart" button to replace with "Call for price" button to encourage users to contact for product prices.
and more | $59 | |
Xtento | Magento 2 Hide Price & Call For Price | Hide product prices, disable add to cart functionality for specific categories/products, or even completely disable customer/ shopping cart features in your Magento 2 store. Make your customers call for pricing information. Configurable on a per customer group and store-view level. Flexible, configurable from the backend and with support for custom themes.
and more | $129 |
IV. Wrapping Up!
In certain circumstances, it’s essential for Magento store owners to hide or disable the Add to cart button. This might be due to some particular reasons, such as reference or non-selling products, out-of-stock products or upcoming products. In these cases, display the product without Add to cart button might be a smart solution that helps store owners to gain SEO and marketing effects, without letting customers add purchase this product.
In order to hide or disable the Add to cart button in Magento 2, store owners can do it programmatically, or take advantage of a Hide price/Call for price extension. These extensions come with a set of features that support your Magento store to run smoothly.
We hope that this article can give you a detailed guideline on how to hide/disable the Add to cart button in Magento 2. We also hope that you can get an overview of all the best Magento 2 Hide Price/ Call for Price Extensions on the market. As the number of Magento 2 PDF Hide Price/ Call for Price is countless, it’s up to your business size and demand to pick the most suitable extension for your store!