magento2 - Magento 2: Update qty in product list page like on cart page -
i added qty input on product list (list.phtml) way implement solution update qty on cart page or minicart? not add cart update qty in product list.
regards matt
you can use this:
<?php $postparams = $block->getaddtocartpostparams($_product); ?> <form data-role="tocart-form" onsubmit="return false;" action="<?php /* @escapenotverified */ echo $postparams['action']; ?>" method="post"> <?php echo $block->getblockhtml('formkey')?> <input type="hidden" name="product" value="<?php /* @escapenotverified */ echo $postparams['data']['product']; ?>"> <input type="hidden" name="<?php /* @escapenotverified */ echo action::param_name_url_encoded; ?>" value="<?php /* @escapenotverified */ echo $postparams['data'][action::param_name_url_encoded]; ?>"> <input type="text" name="qty" id="qty" class="qty" value="1"/> <button type="submit" title="<?php echo $block->escapehtml(__('add cart')); ?>" class="action tocart primary" <span class="label"> <?php /* @escapenotverified */ echo __('add cart') ?> </span> </button> </form>
but work simple products.
Comments
Post a Comment