I already thank everyone who can provide their opinions on this.
I edited the cart note to make it mandatory. When the customer clicks on “check out,” the message appears, but after a few seconds, it still redirects to the checkout, making the mandatory field almost useless.
Sorry, I think the time you tried to access the website, I had enable password to try something (code below).
Now I added a “Select delivery time” also set as required, and still doesn’t work.
When click on check out it shows the message that it should be selected, but it goes through anyways.
The previously code was added on sections/main-cart-footer.liquid and it was basically just the “<textarea required”
already tried class=“required” required=“required” but it didn’t work.
This new attempt do solve the problem, it is a custom liquid on cart section.
I was wondering if it is possible to “gray out” check out button, when none is selected, but haven’t tried yet.
Thank you for your response. The input field needs to be inside a form element in order for the “required” attribute to work. Currently, you seem to be adding the additional element as a separate section, which is not inside the form element.
This is why the required attribute is not restricting users, as both the input and the submit button are working independently. The correct approach would be to make these changes at the DOM level by adding the new element inside the form.
However, I cannot help you with this as I require theme edit access and a little more time.
For now, I have written custom JS to replicate this feature. Please follow the steps below and let me know if this works.
If you require further help to optimize your store, please don’t hesitate to reach out. If you find this information useful, a Like would be greatly appreciated. And if this solves the problem, please Mark it as Solution!