Have your say in Community Polls: What was/is your greatest motivation to start your own business?
Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

mandatory customization field

mandatory customization field

IDOEvent
Visitor
3 0 0

I'm trying to add a mandatory customization field on my Shopify store using the Dawn theme. I want to ensure customers fill out this field before they can proceed to checkout. I have attempted to add the 'required' attribute to the input field in the code, but it hasn't worked. I'm looking for a free solution or code snippet that can help me achieve this. Any assistance or guidance would be greatly appreciated!

Replies 3 (3)

Liam
Community Manager
3108 344 891

Hi IDOEvent,

 

The required attribute might not work in this context - where exactly is the input field that you're adding? Alternatively you could look at using JavaScript validation or setting up an event listener to achieve this as well.

 

 

Liam | Developer Advocate @ Shopify 
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit Shopify.dev or the Shopify Web Design and Development Blog

IDOEvent
Visitor
3 0 0

Thank you for the suggestion! The input field is on the product page where customers can add personalized text. I'm not well-versed in JavaScript. Could you provide a code snippet for JavaScript validation or setting up an event listener to make the customization field mandatory? I appreciate your help!

IDOEvent
Visitor
3 0 0

Thank you for your suggestion on using JavaScript validation or setting up an event listener. The input field is located on the product page where customers can add their name for personalization. It's under a Templates product.custom-name1.json and the sections  is main-custom-name1.liquid . I'm not proficient in JavaScript, so if you could provide a code snippet or further guidance on how to set up JavaScript validation or an event listener to make this field mandatory, that would be extremely helpful. I appreciate your assistance!