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
    Commented Jan 20, 2015 at 23:12

2 Answers 2


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
    Commented Jan 21, 2015 at 14:58
  • How can i solve the add to cart button error, justpaste.it/6fi1f @Lord
    – Gem
    Commented Sep 8, 2018 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 and acknowledge you have read our privacy policy.

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