We have a second add to cart button on our product page, using the following code, see below.
But when a related product is checked and this second add to cart button is clicked, the related product is not added to the cart. When we use the default add to cart button on the product page, the related product is added successfully to the cart.
I guess it has something to do with the duplicate of the
data-role="tocart-form", but I can not find the related code and solution.
Any idea how we can solve this issue?
<div class="box-tocart"> <form data-role="tocart-form" id="product_addtocart_form_sticky" class="product_addtocart_form_sticky" action="<?php echo $block->getAddToCartUrl($product); ?>" method="post"> <?php echo $block->getBlockHtml('formkey')?> <button type="submit" title="Add to Cart" class="action tocart primary small-button"> <span><i class="fad fa-shopping-cart"></i><?= /* @escapeNotVerified */ __('Add to Cart') ?></span> </button> </form> </div>