How can I make a text field mandatory before adding to cart?

Topic summary

Problem: Users need to make custom text fields mandatory on product pages before customers can add items to cart.

Solution for Dawn theme:

  • Add the required attribute to the custom text field input
  • Navigate to the code editor and locate the product form code
  • Remove novalidate: 'novalidate' from the form declaration to enable browser validation

Code location updates:

  • Originally found in sections/main-product.liquid (around line 289)
  • Later moved to snippets/buy-buttons.liquid
  • Current location remains in snippets/buy-buttons.liquid

Result: Once the novalidate attribute is removed, the browser will display an error message if customers attempt to add products without completing required fields. Multiple users confirmed this solution works successfully.

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

Hi! I have the same issue, but I’m using the dawn theme. I’ve added a custom field on the product page, using custom liquid code, but cannot find similar code in the sections/main-product.liquid area but cannot find the novalidate code to remove it. Any help? Thanks!