0

There is a quantity box on each Magento product page. I'd like to hide this quantity selector on Out of Stock product pages.

How can I achieve this?

2
  • They should be hidden. Are you using custom theme? Jan 15, 2015 at 11:52
  • @Reindex'EmAll yes i'm using custom template
    – Moh3n
    Jan 15, 2015 at 15:38

2 Answers 2

0

The template file you'll want to edit is catalog/product/view.phtml The following code does exactly what you're looking to accomplish and it is taken from rwd theme.

<div class="add-to-cart-wrapper">
    <?php echo $this->getChildHtml('product_type_data') ?>
    <?php echo $this->getChildHtml('extrahint') ?>

    <?php if (!$this->hasOptions()):?>
        <div class="add-to-box">
            <?php if($_product->isSaleable()): ?>
                <?php echo $this->getChildHtml('addtocart') ?>
                <?php if( $this->helper('wishlist')->isAllow() || $_compareUrl=$this->helper('catalog/product_compare')->getAddUrl($_product)): ?>
                    <span class="or"><?php echo $this->__('OR') ?></span>
                <?php endif; ?>
            <?php endif; ?>
            <?php echo $this->getChildHtml('addto') ?>
            <?php echo $this->getChildHtml('sharing') ?>
        </div>
        <?php echo $this->getChildHtml('extra_buttons') ?>
    <?php elseif (!$_product->isSaleable()): ?>
        <div class="add-to-box">
            <?php echo $this->getChildHtml('addto') ?>
            <?php echo $this->getChildHtml('sharing') ?>
        </div>
    <?php endif; ?>
</div>
0

change view.phtml in this way:

change this code:

?php if(!$_product->isGrouped()): ?>
   <div class="qty-container clearfix">
       <label for="qty"><?php echo $this->__('Qty') ?>:</label>
       <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
   </div>
<?php endif; ?>

to this:

<?php if(!$_product->isGrouped() && $_product->isSaleable()): ?>
   <div class="qty-container clearfix">
       <label for="qty"><?php echo $this->__('Qty') ?>:</label>
       <input type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
   </div>
<?php endif; ?>

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.