Cart - Add an 'Agree to terms and conditions' checkbox

Hello

He is currently using the Narrative theme.

I have managed to configure in cart-drawer.liquid the checkbox agree with the Terms and Conditions, but I want to make it requiered.

1º) The following code has been put in Assets / Theme.js:

$(document).ready(function() {
    $('body').on('click', '[name="checkout"], [name="goto_pp"], [name="goto_gc"]', function() {
      if ($('#agree').is(':checked')){
        $(this).submit();
      }
     
        alert("You must agree with the terms and conditions of sales to check out.");
        return false;
      }
    });
  });

2º) In both cart-drawer.liquid and cart-template.liquid:


  
  

But I can’t get the box required

HELPPPP!!!

Thanks in advance

hi mc9745

i think this link is very usefully.

https://www.huratips.com/tech-tips/how-to-add-an-agree-to-terms-and-conditions-checkbox-to-shopify-cart-page.html
https://community.shopify.com/topic/614939

If you have questions, just let me know.
Please Contact Skype: live:hardikradadiya355
E-mail: psams7803@gmail.com
Thanks

Hello,
Thank you very much for your answer,
I already have the checkbox configured.

I need help to put it required, and that to go to the next step is only possible by checking the box

I’am in the same position.

I have made check box, but people can get in without check it…

Hello Mariana, I’ve been looking for a solution for two weeks but I can’t find anywhere how to solve it. My company has hired a company certified by shopify, which charges us € 65 to do so. What do you think if we divide the expense between the two and ask them to do it in your store as well, since it is the same problem.
It would be € 32.5.

How about?

Might be some javascript issues, are you getting an errors. I can take a quick look if you can share your store details.

Hey @mc9745 , no need for apps! Check out this brief video tutorial on how to seamlessly add a ‘Agree to Terms and Conditions’ checkbox in your Shopify cart: https://www.youtube.com/watch?v=smyIqWWuZvs

Hello @Jahid-KlinKode , thanks for your code, it works great!

@Jahid-KlinKode , I think I celebrated your solution too fast and you might want to double-check this.

After further testing, I found out that if you visit the Shopify store for the first time with a browser, the Check-out button doesn’t disable. You’ll need to refresh the page once or twice so that the Javascript code can actually apply on the targeted elements. This is not helpful since it means that every new customer connecting to our store will be able to access the checkout page without flagging the checkbox…

Do you want to look into it further?

Thanks for your time and availability.