How to update price after qty changed by dropdown in magento 2. I changed qty input type to dropdown like below code in default.phtml:

 <td class="col qty" data-th="<?php echo $block->escapeHtml(__('Qty')); ?>">
       <div class="field qty">
                <select id="cart-<?php /* @escapeNotVerified */
                echo $_item->getId() ?>-qty" name="cart[<?php /* @escapeNotVerified */
                echo $_item->getId() ?>][qty]" title="<?php echo $block->escapeHtml(__('Qty')); ?>" data - cart - item -
                        id="<?php /* @escapeNotVerified */
                        echo $_item->getSku() ?>">
                    <?php for ($i = 1; $i <= $qty; $i++): ?>
                        <option value="<?php echo $i; ?>"<?php if ($i == $block->getQty()) {
                            echo 'selected';
                        } ?>><?php echo $i; ?></option>
                        <//?php $i = $i + 4; ?>
                    <?php endfor; ?>

As above how to get changed value and update price in cart.

like enter image description here

please help.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.