cancel
Showing results for 
Search instead for 
Did you mean: 

Hiding price for out of stock products.

Hiding price for out of stock products.

Hey guys.

Please advice how to adjust the code to hide price for out of stock products on product pages and category pages? Thx.

11 REPLIES 11

Re: Hiding price for out of stock products.

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.

Re: Hiding price for out of stock products.


@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 Smiley Wink

-----
@benmarks, Senior Manager, Strategy & Growth

Re: Hiding price for out of stock products.

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; ?>
Chris / Placement Edge

Re: Hiding price for out of stock products.

Hello, maybe that extension will solve your problem. It helps hide prices according to different rules that can be defined.

Was my answer helpful? You can accept it as a solution.
230+ professional extensions for M1 & M2 with free lifetime updates!

Re: Hiding price for out of stock products.

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

Re: Hiding price for out of stock products.

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; ?>

 

Re: Hiding price for out of stock products.

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.


 

 ,

Re: Hiding price for out of stock products.

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

Re: Hiding price for out of stock products.

Also have same issue(s)

 

Can get rid of it on product page, but not cat list pages.