1

In a Product Detail Page after Quantity add checkbox when checkbox button is checked than "add to cart" button stay active if not click on checkbox than disable button.

Thanks,

  • Have you tried anything from your side? – Rakesh Jesadiya Jun 21 '17 at 9:16
  • yes i have done it.. look @ Answer. – Sarfaraj Sipai Jun 21 '17 at 10:18
2

I have override the in custom theme file addtocart.phtml file after qty box i have added a checkbox. like

<input type="checkbox" name="add_to_cart" id="add_to_cart">

after that at the end of the page i have add custom jquery for check box is checked or not..! like

<script type="text/javascript">
require(['jquery'], function ($) {
    jQuery(".tocart").click(function(){
        if (jQuery('.control #add_to_cart').is(':checked') === false) {
                    alert("Please check at least one item");
                    return false;
        }
    });
});

</script>

and it's work..! try it.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.