Disable Coupon Code – Fix Issues After Deleting Discount Code Block in Magento Cart

coupon-codesmagento-1shopping-cart

I don't want to use coupon code block on cart page so I delete the code on this file

/app/design/frontend/base/default/layout/checkout.xml

"block type="checkout/cart_coupon" name="checkout.cart.coupon" as="coupon" template="checkout/cart/coupon.phtml"

This update works, there is no coupon code on my cart page, but if there is two or more items and I delete one of them, the discount code block show again and looks weird

Normal

https://www.dropbox.com/s/g4y9azefnyv5n2y/Cap%202014-10-05%2000-27-33-613.png?dl=0

After delete product

https://www.dropbox.com/s/qbgc3r5jdg7dknq/Cap%202014-10-05%2000-28-07-066.png?dl=0

What should I do the cart page work well after delete product?

or is there any other way to disable coupon code which don't make this problem?

Best Answer

Firstly you should never make changes to the core files. This includes your layout and template files located in the base folders. This would be considered a core hack, and will lead to issues down the road, especially when you upgrade.

The correct way to remove the coupon is via your local theme. There are a few different ways to apply this. One is via your theme local.xml file.

This file can be located in various places, all depending if you just use a theme, or a package, with a theme.

In this example, I am using a package, and the file is thus located here: /app/design/frontend/YOUR _PACKAGE/default/layout/local.xml

In there you will have a directive as such:

<checkout_cart_index>
 <reference name="checkout.cart">
    <remove name="checkout.cart.coupon"/>
 </reference>
</checkout_cart_index>

Hope that helps

Related Topic