I have a notes field shown on the cart page. When a customer fills the field out and clicks "Checkout" the contents are not saved. Same goes for Quantity or other custom fields. If "Update Cart" is chosen the data is saved. Is there any way to prevent the checkout from continuing if these fields have content? Or would this need to be done via something like javascript validation?

<form method="POST">
    <input type="hidden" name="action" value="commerce/cart/update-cart">
    <input type="hidden" name="cartUpdatedNotice" value="The cart was updated.">
    {{ redirectInput('shop/cart') }}
    {{ csrfInput() }}
   <textarea type="text" name="lineItems[{{ item.id }}][note]" value="{{ item.note }}">{% if item.note %}{{ item.note }}{% else %}{% endif %} </textarea>

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.