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,

Sarfaraj Sipai
  • 976
  • 2
  • 13
  • 29

1 Answers1

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.

Sarfaraj Sipai
  • 976
  • 2
  • 13
  • 29