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.

Thanks for the code snippets to achieve the required functionality.

In the Dawn theme, please look for the other matching files as mentioned below:

  1. cart.js INSTEAD OF theme.js or theme.js.liquid
  2. main-cart-footer.liquid INSTEAD OF cart-template.liquid or cart.liquid

Also, use <a href=“/pages/terms-and-conditions” target=“_blank”> INSTEAD OF just so that the original cart page is intact. And, the terms & conditions page opens up in a new window, which could be closed after reading and still the cart window is available for the customer to checkout.

All this worked for me in Debut theme. I believe this information would help!

3 Likes