Magento 1.9 – How to Remove Add to Wishlist from Shopping Cart

magento-1.9shopping-cartwishlist

Using 1.9.0.1

Here is the situation:

  • not logged in

  • adding some product to cart (no problem)

  • go to "view cart"

  • fields: image, description, edit, unit price, qty, subtotal, remove

Situation 2:

  • logged in now

  • adding some product to cart (no problem)

  • go to "view cart"

  • fields: image, description, edit, add to wishlist!!!, unit price, qty, subtotal, remove

How do i get rid of the add to wishlist from this?

I know i can set display none using like this:
.cart-table th:nth-child(3), .cart-table td:nth-child(3), .cart-table th:nth-child(4), .cart-table td:nth-child(4) {
display: none;
}

BUT…

when i do this it works great for when NOT LOGGED IN, and when LOGGED IN, it added an extra th so it is messed up…

Anyone know where i can safely delete that add to wishlist function from cart view?

Thanks

Best Answer

You have 2 options here.
Option 1.
Edit all cart and cart item templates and remove the wishlist column.
For this you need to edit:

  • checkout/cart.phtml
  • checkout/cart/item/default.phtml
  • downloadable/checkout/cart/item/default.phtml

Option 2
Override the Mage_Wishlist_Helper_Data::isAllowInCart method and make it return false always.
For this second option you need a new module. Let's call it Easylife_Wishlist. Create these files:

app/etc/modules/Easylife_Wishlist.xml - the declaration file:

<?xml version="1.0"?>
<config>
    <modules>
        <Easylife_Wishlist>
            <codePool>local</codePool>
            <active>true</active>
            <depends>
                <Mage_Wishlist />
            </depends>
        </Easylife_Wishlist>
    </modules>
</config>

app/code/local/Easylife/Wishlist/etc/config.xml - the configuration file

<?xml version="1.0"?>
<config>
    <modules>
        <Easylife_Wishlist>
            <version>1.0.0</version>
        </Easylife_Wishlist>
    </modules>
    <global>
        <helpers>
            <wishlist>
                <rewrite>
                    <data>Easylife_Wishlist_Helper_Data</data> <!-- tell magento to use your own helper instead of the default one -->
                </rewrite>
            </wishlist>
        </helpers>
    </global>
</config>

app/code/local/Easylife/Wishlist/Helper/Data.php - your new helper

<?php 
class Easylife_Wishlist_Helper_Data extends Mage_Wishlist_Helper_Data 
{
    public function isAllowInCart()
    {
        return false;
    }
}

Clear the cache, disable compilation if enabled and you are done.