Need to make text box compulsory in product page

Topic summary

A user is attempting to make a text input field mandatory on a product page, preventing customers from adding items to cart without completing it.

Current Issue:

  • Added a required class attribute to the input field
  • The validation isn’t functioning as expected

Code Context:

  • Using custom Liquid code for a text field (appears to be for waist measurements in cm)
  • The code snippet shows HTML input with required attribute and class
  • Field is labeled “Waist (in cm)”

Status: The question remains unanswered with no solutions or responses provided yet. The user needs guidance on proper implementation of required field validation in their e-commerce platform’s product page.

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

Hi,

I want to make text box compulsory in product page - customer should not be able to add the item to cart without filling the text field. Below is my custom liquid code:

<p class="line-item-property__field">
<label for="waist-in-cm">Waist (in cm)</label> <br>
<input required class="required" id="waist-in-cm" type="text" name="properties[Waist (in cm)]">
</p>

I have used class = “required” but it doesn’t seem to work