Skip to main content

For adding '+' & '-' button on your quantity in magento cart, please Find below code from file - app\design\frontend\[your package]\[your theme]\template\checkout\cart\item\default.phtml

app\design\frontend[your package][your theme]\template\checkout\cart\item\default.phtml

<input type="text" pattern="\d*" name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="4" data-cart-item-id="<?php echo $this->jsQuoteEscape($_item->getSku()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" maxlength="12" />

and replace it with

<a href="#" class="minus-item">-</a>
<input type="text" pattern="\d*" name="cart[<?php echo $_item->getId() ?>][qty]" onchange="$('FORM-ID HERE').submit()" value="<?php echo $this->getQty() ?>" size="4" data-cart-item-id="<?php echo $this->jsQuoteEscape($_item->getSku()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" maxlength="12" />
<a href="#" class="plus-item">+</a>

add two anchors with a class and increment and decrements signs

NOTE- PLeasePlease look for the FORM-ID HERE ID on your form Tag.

And add the script to the bottom of your page:

<script type="text/javascript">
    $(document).on('click', 'a.minus-item', function(e){
    e.preventDefault();
    input = $(this).next('input');
    newVal = parseInt(input.val())-1;
        if(newVal > 0){
            input.val(newVal);
            $('#FORM-ID HERE').submit();
        }
    });
    $(document).on('click', 'a.plus-item', function(e){
    e.preventDefault();
    input = $(this).prev('input');
    newVal = parseInt(input.val())+1;
        if(newVal > 0){
            input.val(newVal);
            $('#FORM-ID HERE').submit();
        }
    });
</script>

Hope this will help...!!!

For adding '+' & '-' button on your quantity in magento cart, please Find below code from file - app\design\frontend\[your package]\[your theme]\template\checkout\cart\item\default.phtml

<input type="text" pattern="\d*" name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="4" data-cart-item-id="<?php echo $this->jsQuoteEscape($_item->getSku()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" maxlength="12" />

and replace it with

<a href="#" class="minus-item">-</a>
<input type="text" pattern="\d*" name="cart[<?php echo $_item->getId() ?>][qty]" onchange="$('FORM-ID HERE').submit()" value="<?php echo $this->getQty() ?>" size="4" data-cart-item-id="<?php echo $this->jsQuoteEscape($_item->getSku()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" maxlength="12" />
<a href="#" class="plus-item">+</a>

add two anchors with a class and increment and decrements signs

NOTE- PLease look for the FORM-ID HERE ID on your form Tag.

And add the script to the bottom of your page:

<script type="text/javascript">
    $(document).on('click', 'a.minus-item', function(e){
    e.preventDefault();
    input = $(this).next('input');
    newVal = parseInt(input.val())-1;
        if(newVal > 0){
            input.val(newVal);
            $('#FORM-ID HERE').submit();
        }
    });
    $(document).on('click', 'a.plus-item', function(e){
    e.preventDefault();
    input = $(this).prev('input');
    newVal = parseInt(input.val())+1;
        if(newVal > 0){
            input.val(newVal);
            $('#FORM-ID HERE').submit();
        }
    });
</script>

Hope this will help...!!!

For adding '+' & '-' button on your quantity in magento cart, please Find below code from file -

app\design\frontend[your package][your theme]\template\checkout\cart\item\default.phtml

<input type="text" pattern="\d*" name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="4" data-cart-item-id="<?php echo $this->jsQuoteEscape($_item->getSku()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" maxlength="12" />

and replace it with

<a href="#" class="minus-item">-</a>
<input type="text" pattern="\d*" name="cart[<?php echo $_item->getId() ?>][qty]" onchange="$('FORM-ID HERE').submit()" value="<?php echo $this->getQty() ?>" size="4" data-cart-item-id="<?php echo $this->jsQuoteEscape($_item->getSku()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" maxlength="12" />
<a href="#" class="plus-item">+</a>

add two anchors with a class and increment and decrements signs

NOTE- Please look for the FORM-ID HERE ID on your form Tag.

And add the script to the bottom of your page:

<script type="text/javascript">
    $(document).on('click', 'a.minus-item', function(e){
    e.preventDefault();
    input = $(this).next('input');
    newVal = parseInt(input.val())-1;
        if(newVal > 0){
            input.val(newVal);
            $('#FORM-ID HERE').submit();
        }
    });
    $(document).on('click', 'a.plus-item', function(e){
    e.preventDefault();
    input = $(this).prev('input');
    newVal = parseInt(input.val())+1;
        if(newVal > 0){
            input.val(newVal);
            $('#FORM-ID HERE').submit();
        }
    });
</script>

Hope this will help...!!!

Source Link
Lalit838
  • 313
  • 1
  • 15

For adding '+' & '-' button on your quantity in magento cart, please Find below code from file - app\design\frontend\[your package]\[your theme]\template\checkout\cart\item\default.phtml

<input type="text" pattern="\d*" name="cart[<?php echo $_item->getId() ?>][qty]" value="<?php echo $this->getQty() ?>" size="4" data-cart-item-id="<?php echo $this->jsQuoteEscape($_item->getSku()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" maxlength="12" />

and replace it with

<a href="#" class="minus-item">-</a>
<input type="text" pattern="\d*" name="cart[<?php echo $_item->getId() ?>][qty]" onchange="$('FORM-ID HERE').submit()" value="<?php echo $this->getQty() ?>" size="4" data-cart-item-id="<?php echo $this->jsQuoteEscape($_item->getSku()) ?>" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Qty')) ?>" class="input-text qty" maxlength="12" />
<a href="#" class="plus-item">+</a>

add two anchors with a class and increment and decrements signs

NOTE- PLease look for the FORM-ID HERE ID on your form Tag.

And add the script to the bottom of your page:

<script type="text/javascript">
    $(document).on('click', 'a.minus-item', function(e){
    e.preventDefault();
    input = $(this).next('input');
    newVal = parseInt(input.val())-1;
        if(newVal > 0){
            input.val(newVal);
            $('#FORM-ID HERE').submit();
        }
    });
    $(document).on('click', 'a.plus-item', function(e){
    e.preventDefault();
    input = $(this).prev('input');
    newVal = parseInt(input.val())+1;
        if(newVal > 0){
            input.val(newVal);
            $('#FORM-ID HERE').submit();
        }
    });
</script>

Hope this will help...!!!