Add an 'Agree to terms and conditions' checkbox to cart

New Member
1 0 0

I can't get the checkbox in the cart to work correctly. Customers are able to checkout without clicking the box.

I'm using the Minimal theme which is Sectioned and I followed the instructions from https://help.shopify.com/en/themes/customization/cart/add-terms-and-conditions-checkbox#sectioned-th...

But customers are able to checkout without clicking the box. 

I believe it has to do with this part of the code

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

 that I entered at the bottom of my theme.js located under Assets.

 

The code I pasted into my cart works and looks fine. If anyone has any tips or suggestions it would be much appreciated.

 

0 Likes
Shopify Staff
Shopify Staff
524 1 72

Hey, Meghan!

I'm Alex, with the Shopify team!

Sorry to hear this is causing you issues! This is considered an advanced customization that we're limited in our ability to support, but I'd be more than happy to have a look over the changes you've made to your theme code and see if I can identify any issues. I'll send you out an email once I've posted this response - just get back to me there, and I can check it out!

Additionally, you can always give us a call or start a live chat at any time. We're open 24/7 for your convenience and always happy to assist!

Cheers,

Alex | Shopify

0 Likes
New Member
2 0 1

Having the exact same problem. Did you find a solution?

 


@Meghan_Montoya wrote:

I can't get the checkbox in the cart to work correctly. Customers are able to checkout without clicking the box.

I'm using the Minimal theme which is Sectioned and I followed the instructions from https://help.shopify.com/en/themes/customization/cart/add-terms-and-conditions-checkbox#sectioned-th...

But customers are able to checkout without clicking the box. 

I believe it has to do with this part of the code

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

 that I entered at the bottom of my theme.js located under Assets.

 

The code I pasted into my cart works and looks fine. If anyone has any tips or suggestions it would be much appreciated.

 


 

1 Like
New Member
2 0 0

+1


@hausecec wrote:

Having the exact same problem. Did you find a solution?

 


@Meghan_Montoya wrote:

I can't get the checkbox in the cart to work correctly. Customers are able to checkout without clicking the box.

I'm using the Minimal theme which is Sectioned and I followed the instructions from https://help.shopify.com/en/themes/customization/cart/add-terms-and-conditions-checkbox#sectioned-th...

But customers are able to checkout without clicking the box. 

I believe it has to do with this part of the code

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

 that I entered at the bottom of my theme.js located under Assets.

 

The code I pasted into my cart works and looks fine. If anyone has any tips or suggestions it would be much appreciated.

 


 


 

0 Likes
New Member
2 0 0

@hausecec wrote:

Having the exact same problem. Did you find a solution?


Actually, I have found the issue now. The problem for me was that the minified js file "assets/theme.min.js" needed to be updated as well, not just the theme.js file.

0 Likes