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

Topic summary

A tutorial explains how to add a mandatory ‘Agree to terms and conditions’ checkbox to Shopify cart pages using custom code. The implementation differs between sectioned themes (post-2016) and non-sectioned themes, requiring edits to theme.js/theme.liquid and cart template files with jQuery code.

Key Implementation Issues:

  • The checkbox can only be added to the cart page, not the actual checkout page (unless using Shopify Plus at $2,000+/month)
  • Many users report the checkbox appears but isn’t actually required—customers can bypass it
  • Solutions include adding required="required" attribute or creating a separate custom.js file
  • Additional checkout buttons (Apple Pay, Google Pay) bypass the validation entirely

Theme-Specific Challenges:

  • Dawn, Debut, Narrative, Prestige, and Brooklyn themes require different approaches
  • Some themes need code in custom.js instead of theme.js due to load order issues
  • jQuery version must be 1.7 or higher for the code to function

Legal Compliance Concerns:

  • Multiple users note this workaround is insufficient for EU/German regulations requiring checkboxes at final checkout
  • The limitation frustrates merchants needing proper consent collection for legal compliance

Current Solutions:

  • A free app (RA Terms and Conditions Checkbox) now exists as an alternative to manual coding
  • Various code modifications shared for handling cart drawers, multiple checkboxes, and styling adjustments
Summarized with AI on November 2. AI used: claude-sonnet-4-5-20250929.

Hello, this tutorial is really helpful and I manage to add a required checkbox on my cart page.

However, the “required” field doesn’t prevent the customer to proceed with checkout through the additional checkout buttons (Google Pay, Apple Pay etc). Is there any way to block the user to compile required fields before heading to the quick checkout experience?

Thanks in advance

EDIT: I was able, in the meantime, to disable the buttons until the checkbox is selected:

theme.js

$("#additional-buttons-c").addClass("div-disabled");
$(document).ready(function() {
  $('body').on('click', '[name="agree"]', function() {
    if ($('#agree').is(':checked')) {
      $("#additional-buttons-c").removeClass("div-disabled");
    }
    else {
      $("#additional-buttons-c").addClass("div-disabled");
    }
  });
});

theme.scss.liquid:

.div-disabled {
    pointer-events: none;
    opacity: 0.4;
}

cart template:

{%- if additional_checkout_buttons -%}
<div id="additional-buttons-c" class="additional-checkout-buttons">{{ content_for_additional_checkout_buttons }}</div>
{%- endif -%}
3 Likes

Hi , Would you mind letting me know how you find the link of URL of your terms and conditions page? Thanks in advance

Hey thanks for the update Gab,

any chance you could send a screenshot of what it would look like incorporated into your code?

Thanks in Advance

The complete code is already pasted above.

Best regards

Hi,

thanks for the tutorial. This really worked fine for me!

But I need more than 1 check box.

Can you give me code for second checkbox?

Thank you!!

Tip: It’s not possible to add the checkbox to the checkout pages. It can be added only to the cart page that exists at http://www.your-shop-URL.com/cart.

And this is exactly the kind of restrictions that make me move to another solution as soon as I can, because -aside of the fact that I don’t feel free to do what I want with my shop- the checkbox is a mandatory thing in some countries, and having it in the cart before payment pages is a very bad choice as it hurts conversions.

1 Like

It’s a shame that shopify don’t offer the possibility to add this checkbox…

2 Likes

Thanks for the tutorial. I’m using Debut and the button now shows on my site, but it can be bypassed by either not simply marking the box or clicking “buy now” button. Moreover, now when you click “Buy now” button, the button fades away before taking you to checkout, resulting in a longer waiting time before reaching the checkout page.

Any solution?

P.S I’m using the latest debut version, which is probably updated compared to the one of this tutorial.

hi there,

could you find a solution for the error in the “required” portion,i am still unable to find the perfect solution for this. Easily can be bypassed without giving tick mark in the check box.

Can you help me?

@gab33

hi there,

could you find a solution for the error in the “required” portion,i am still unable to find the perfect solution for this. Easily can be bypassed without giving tick mark in the check box.

Can you help me?

1 Like

Hello,
I’ve contacted for 25 dollars a shopify expert that worked on the code and
did a perfect job.
In just one day everything was working well. Honestly I’d advice this.
Best,

Hi,

Thanks a lot..i got the solution…

1 Like

HI @TyW ,

Thanks a lot for your guided tutorial…

Which expert to recommend please? i need it

Which expert to recommend please? i need it

I’ve asked to them: kcprvn@gmail.com
They are Shopify certified experts
Have fun!

Has anyone figured out how to solve the issue with being able to proceed to checkout even if the checkbox isn’t checked?

I have spent several hours troubleshooting with JS and HTML and can’t seem to figure it out.

I would greatly appreciate some help. I am using the Supply theme if that helps.

Thanks!

Hi,

i have added this in my registration page, you can add the below code in your respective page where you want to see the “terms and policy”.

##If you want to add this in your cart page, then just add name=“register” in the respective input button line.

##put the script tag below your html code, at the last part.

hope that it works out for you.

Here i have added the code which works well for me in my registration page before entering into my store.

HTML Part:

I agree with the terms and conditions.

JS Part:

1 Like

Hi Ty,

Thanks for the info.

Any chance you could tell me how to display the terms and conditions page within a popup instead of leaving the cart page as it is now.

Thanks

Hi,

That is what i couldn’t figure out how to add those terms and condition page