1

I was able to print a div when the price is 0 in this way

<?php if ($this->getProduct()->getFinalPrice()==0) : ?>

CALL NOW 123336541

<?php return; ?>

how do I disable add to cart when the price is 0?

2 Answers 2

1

please try

<?php if($_product->getPrice() != '0.00') {?> <button type="button" title="<?php echo $this->quoteEscape($this->__('Add to Cart')) ?>" class="button btn-cart" onclick="setLocation('<?php echo $this->getAddToCartUrl($_product) ?>')"> <span><span><?php echo $this->__('Add to Cart') ?></span></span></button> <?php } ?>

3
  • in what file include this code?
    – yavonz15
    May 6, 2016 at 13:09
  • to disable from list page you need to make change at app\design\frontend\{package_name}\{theme_name}\template\catalog\product\list.phtml May 6, 2016 at 13:11
  • and to remove from product details page you need to make changes at app\design\frontend\{package_name}\{theme_name}\template\catalog\product\view\addtocart.phtml near line no 38-40 and in list.phtml near line no 90 and 153 May 6, 2016 at 13:14
0

have done so

on list.phtml

<?php if(!$_product->canConfigure() && $_product->isSaleable() && $_product->getPrice() != '0.00'): ?>

on addtocart.phml

<?php if ($_product->isSaleable() && ($_product->getPrice() != '0.00')):  ?>

add x to the end of the if conditions ($_product->getPrice() != '0.00')

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.