Search code examples
magentomagento-1.9

Change the quantity field in a cart to an unchangeable


how to make quantity field of items in the cart unchangeable.just display '1' but without update it. i tried `

/app/design/frontend/base/default/template/checkout/cart/item/default.phtml 

or

/app/design/frontend/default/your-theme/template/catalog/product/view/addtocart.phtml

but nothing happens


Solution

  • you can use readonly attribute for quantity input field like below .It will not let user to chnage the qty.

            <input readonly = "readonly" type="text" name="qty" id="qty" maxlength="12" value="<?php echo $this->getProductDefaultQty() * 1 ?>" title="<?php echo $this->__('Qty') ?>" class="input-text qty" />
    

    hope this will solve your problem. Thanks