Hello,
I recently switched our store to a new theme and am having a new issue with an item that previously worked. We have a required field on many of our product pages, that the customer must complete before they can add this item to cart, with the new Prestige theme, customers are able to add the product to cart even without completing the fields. Previously, if this field was not completed, the customer saw a message to complete first.
The fields are set to required and I have checked for novalidate - all is good on this end, so I am unsure what is missing now with the Prestige theme.
I have been researching and testing for weeks now with no success, I’d appreciate the help greatly!
Hi @abrown0625 disable javascript in your browser.
If you can’t submit with javascript disbled then it’s related javascript submitting the form.
If you need the javascript debugged you then contact me , info in sig. Please provide context: store url, theme name, post url and detail.
If you can submit with disabled javascript check that your required inputs are actually inside the |{%form%} tags or reference the form with a form attribute on the inputs.
If you switched from a vintage theme to a OS2.0 theme that uses blocks be aware that buy-button/add-to-cart blocks tend to be the isolated forms of the product pages submission process.
The other inputs like quantity, variant options will use the form attribute on those inputs to associated inputs to the separate non-parent form by it’s #ID attribute.
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input#form
So if required fields need to be outside the form update them to match the logic that makes the form-id value.
Dawn reference structure for forms separate from non-parented form inputs
button snippet https://github.com/Shopify/dawn/blob/main/snippets/buy-buttons.liquid#L30
product_form_id variable creation: https://github.com/Shopify/dawn/blob/main/sections/main-product.liquid#L70
quantity inputs form attribute usage: https://github.com/Shopify/dawn/blob/main/sections/main-product.liquid#L249
actual separate creation of the product form as a ‘buy buttons’ block:
https://github.com/Shopify/dawn/blob/main/sections/main-product.liquid#L312