Adding Checkbox to Cart Refreshes Page Automatically

Topic summary

A developer working with the Alchemy theme is implementing a consent checkbox on the cart page that controls the checkout button’s enabled/disabled state.

Current behavior:

  • Checkbox successfully enables the checkout button when checked
  • Page automatically refreshes after checking the checkbox
  • After refresh, the checkbox becomes unchecked and button returns to disabled state

Technical details:

  • The auto-refresh occurs even when JavaScript code is removed
  • Code includes HTML markup for the checkbox and consent disclosure text
  • Implementation uses Liquid theme files

Core problem: The unexpected page refresh is preventing the checkbox state from persisting, breaking the intended user flow. The developer is seeking to understand why the automatic refresh is happening.

Summarized with AI on November 8. AI used: claude-sonnet-4-5-20250929.

Hi everyone,

I am working on the Alchemy theme and I want to add a checkbox to the cart page.

My goal is:

  • The checkout button is disabled by default.
  • If the user checks the checkbox, the checkout button is enabled, allowing the user to proceed.

The issue I’m facing is: After adding the checkbox and checking it, the button gets enabled correctly. However, the cart page refreshes automatically, causing the checkbox to become unchecked again and the button to be disabled. This behavior occurs even if I remove my JavaScript code. Why does the page refresh automatically?

Here is the code I added to theme.liquid:


              

CONSENT TO THE DISCLOSURE OF MY DATA