Add quantity 2 when adding to cart from product view page.
For only one product because it calls 2-time post request for one product.
After clearing cache and checking and some time that works, but again that problem comes in other product.
Magento Stack Exchange is a question and answer site for users of the Magento e-Commerce platform. It only takes a minute to sign up.Sign up to join this community
\Magento\Checkout\Controller\Cart\Add::execute() method has support for the
qty request param. Try adding a new hidden input named
qty and value of
2 in the add-to-cart form template file.
Maybe there's a more elegant way of doing this, but I don't know about it yet.
<input type="number" name="qty" id="qty" maxlength="12" value="<?php /* @escapeNotVerified */ echo $block->getProductDefaultQty() * 1 ?>" title="<?php /* @escapeNotVerified */ echo __('Qty') ?>" class="input-text qty" data-validate="<?php echo $block->escapeHtml(json_encode($block->getQuantityValidators())) ?>" />
change value to "2"
Hello it happen with me.
Solution for that:addtocart intilize two times on page so find out and remove it