We want to display the add to cart button to our up-sell block on product page. I tried this code, but that does not work and brake down the page

<button class="button related" type="button" onclick="location.href='<?php echo $this->getAddToCartUrl($_item) ?>'"><span><?php echo $this->__('Add to Cart') ?></span></button>

We do use this same code for the related block on the page, maybe that's the problem?

What code do I need to display the add to cart button for the up-sell block?


  • can you show your crossell product code,?
    – Amit Bera
    Jan 20 '15 at 23:12

Replace $this->getAddToCartUrl($_item) with $this->getAddToCartUrl($_link). This should work unless you changed variable names in upsell.phtml

  • Great, that did the trick! :)
    – JGeer
    Jan 21 '15 at 14:58
  • How can i solve the add to cart button error, justpaste.it/6fi1f @Lord
    – Gem
    Sep 8 '18 at 4:52

find the items.phtml file in module catalog using template path hints ,here you can configure each products type (related,cross cell and up sell) inside switch case statements.select the product type and change:

$showCart = true;.

I recommend to extend the module in custom theme directory.This worked for me perfectly in product view page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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