Hey guys.
Please advice how to adjust the code to hide price for out of stock products on product pages and category pages? Thx.
Are you comfortable editing theme files?
If so, template/catalog/product/price.phtml looks pretty straightforward (and already has the product model object in $_product), so I'd just check to see if it's in stock, and use that to optionally hide the price entirely.
I think that covers all displays of the price in the theme, but that is just off the top of my head - double check, of course. That should be a reasonable start, though.
@Mike Ward wrote:
template/catalog/product/price.phtml looks pretty straightforward
I beg to differ, and I'm not the only one I'm sure
RWD Theme
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; ?>
Default Theme:
\app\design\frontend\base\default\template\catalog\product\view\type\default.phtml
Change
<?php echo $this->getPriceHtml($_product) ?>
To:
<?php if($_product->isSaleable()): ?>
<?php echo $this->getPriceHtml($_product) ?>
<?php endif; ?>
Hello, maybe that extension will solve your problem. It helps hide prices according to different rules that can be defined.
Please check the following Magento extension if it can help you, it allows you to hide price and set custom stock statuses,
http://www.magentocommerce.com/magento-connect/custom-stock-labels.html
Excellent answer. Kudos PlacementEdge.
If you would like to hide the price for grouped items you can do the same trick. Here's what my RWD child theme on
/app/design/frontend/foo/bar/template/catalog/product/view/type/grouped.phtml
<?php if ($this->getCanShowProductPrice($_item)): ?> <?php echo $this->getPriceHtml($_item, true) ?> <?php echo $this->getTierPriceHtml($_item) ?> <?php endif; ?>
to
<?php if ($this->getCanShowProductPrice($_item)): ?> <?php // hide price if out of stock ?> <?php if ($_item->isSaleable()) : ?> <?php echo $this->getPriceHtml($_item, true) ?> ?php echo $this->getTierPriceHtml($_item) ?> <?php endif; ?> <?php endif; ?>
Hello marknoah3,
I know one extention which may help you in solving this problem. It's called magento 2 hide price by Itoris Inc. It let's you hide product prices for particular user groups as well as calling for pricing and showing custom messages. In addition to that, product prices may be hidden on the global scale or for certain store view or specific customer groups. Users may disable this feature for a certain period of time.
,
i need help also i have fix it, now the price not showing on product page but the price is still showing on category page for the items out of stock i need to fix it
urgent help for this.
Advance Thanks
Also have same issue(s)
Can get rid of it on product page, but not cat list pages.