Magento Cart Buttons

March 11, 2013 · Post

Sometimes I find myself needing to modify the default behavior of Magento’s Add to Cart button. If it’s a Bundled Product, for example, the default Cart button in the Grid and List views will throw an error at the user if the bundle has required options1. It makes more sense for the button to say something like Configure Now, and take the user to the product page.

Below are a couple of Gists of mine that have various ways to modify the front-end of a Magento site’s Add to Cart buttons. Of course, always back up your theme files before modifying them (or use Git). And never modify core unless you’re prepared to deal with it.

Conditional Bundle Button

Use this in list.phtml to change the button based on whether it’s a Simple or Bundle Product. This could also be expanded to cover Configurable Products as well.

CMS Block Button

This one is super custom - I used it in addtocart.phtml to replace the Add to Cart button with a link based on input from a URL Product Attribute.

1Magento 1.6, Blank theme. Things may be different with other themes and versions.