1

I have an in issue Magento 1.9

  1. I want to hide product price when it's out of stock but item needs to be showing on the website.
  2. Only hide price and it will show out of stock.

I tried these codes but get no result

RWD Theme:

Magento_root/app/design/frontend/rwd/template/catalog/product/view.phtml

Change

<div class="price-info">
    <?php echo $this->getPriceHtml($_product); ?>
    <?php echo $this->getChildHtml('bundle_prices') ?>
    <?php echo $this->getTierPriceHtml() ?>
</div>

To:

<?php if($_product->isSaleable()): ?>
    <div class="price-info">
        <?php echo $this->getPriceHtml($_product); ?>
        <?php echo $this->getChildHtml('bundle_prices') ?>
        <?php echo $this->getTierPriceHtml() ?>
    </div>
<?php endif; ?>
  • why do you use tags for m1 and m2? – LucScu Nov 28 '17 at 9:00
2

Yes, you need modify the following template of the default theme of the RWD design package:

Magento_root/app/design/frontend/rwd/default/template/catalog/product/view.phtml

Please use the following code:

<?php if ($_product->getIsInStock()): ?>
    <div class="price-info">
        <?php echo $this->getPriceHtml($_product); ?>
        <?php echo $this->getChildHtml('bundle_prices') ?>
        <?php echo $this->getTierPriceHtml() ?>
    </div>
<?php endif; ?>

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.