0

How to Remove "Add to cart" Button On all Frontend Pages And also want to know when "Add to cart" Button is Removed then Buyer Can Checkout or not?

I am using Magento 1.9.2.3 version.

3 Answers 3

1

Open cPanel or FTP and navigate to the following files:

app\design\frontend\tm_themes\themeXXXX\template\catalog\product\compare\list.phtml

app\design\frontend\tm_themes\themeXXXX\template\review\customer\list.phtml

app\design\frontend\tm_themes\themeXXXX\template\review\product\view\list.phtml

app\design\frontend\tm_themes\themeXXXX\template\tm\productlistgallery\list.phtml

app\design\frontend\tm_themes\themeXXXX\template\wishlist\item\list.phtml

Due to the fact the catalog pages can by viewed in either grid or list mode, there are two references to the Add to Cart button in the code within the list.phtml file. Make sure to comment out the code in both sections.

Look up this code and comment it: ?

<button type="button" title="<?php echo $this->__('Add to Cart') ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"><span><span><?php echo $this->__('Add to Cart') ?></span></span></button>

Buyer can checkout even after removal of this add to cart button. Because whenever you click on the product from product list page it will take you to magento's product detail page.there you can add product to cart.then you can go to checkout that product.

3
  • My question apart from this port, i want to add to cart button for my custom page and added the code above you mentioned, its not working, could you help me to find out the error my code -> justpaste.it/5xyl7
    – Gem
    Commented Sep 17, 2018 at 12:24
  • @Rathinam link to your code is not working. It would be better if you raise a new question on stack exchange with all the details.
    – NID
    Commented Sep 17, 2018 at 15:06
  • someone already posted, and ans is magento.stackexchange.com/a/237560/57334, could you answer that question.
    – Gem
    Commented Sep 18, 2018 at 7:17
0

The simplest thing you can do is make the display hidden for "btn-cart" class but this will not stop the add to cart functionality. if the user hits the direct Add to Cart url of any product, this will add the product to the cart and checkout will also work. You can write the CSS for hiding the button at style.css or any other custom CSS.

Please describe in which case you want to hide this button for the more specific solution.

0

This code remove your add to cart button from all pages

app\code\Vendorename\Modulename\etc

di.xml

<?xml version="1.0" encoding="UTF-8"?>

<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
    <type name="Magento\Catalog\Model\Product">
        <plugin name="hidecartbutton" type="Vendorename\Modulename\Plugin\Hidecartbutton" sortOrder="1"/>
    </type>
</config>

app\code\Vendorename\Modulename\Plugin

Hidecartbutton.php

<?php

namespace Vendorename\Vendorename\Plugin;

use Magento\Catalog\Model\Product;

class Hidecartbutton
{

    public function afterIsSaleable(Product $product, $isSaleable)
    {
        return false;
    }
}

I Hope This Helps You.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.