Accepting credit cards, warehouses, and shipping and fulfilling orders
I have the below code in my Debut theme for customers to select a delivery date. It appears in the cart before checkout. I would like to make it a required field. Can someone help me to make it required field? 🙂
{{ '//code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css' | stylesheet_tag }}
<script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js" defer="defer"></script>
<div style="width:300px; clear:both;">
<p>
<label for="date">Preferred delivery/Pick up date (mm/dd/yyyy):</label>
<input id="date" type="text" name="attributes[date]" value="{{ cart.attributes.date }}" />
<span style="display:block" class="instructions"> Please note we do not accept pickup or deliveries on Sundays.</span>
</p>
</div>
<script>
window.onload = function() {
if (window.jQuery) {
let $ = window.jQuery;
$(function() {
$("#date").datepicker({
minDate: +2,
maxDate: '+3M',
});
});
}
}
</script>
Hi, @arflorezo
What you need is adding the required parameter in the input tag
<input id="date" type="text" name="attributes[date]" value="{{ cart.attributes.date }}" required="required" />
I still have the same issue. Used the "required" code addition and still does not work (allows for checkout without date entered). Using "Simple" theme.
Any ideas?
Hello PremierStores, unfortunately it doesn't work. Do you have another idea?
Hi, @arflorezo :
Your form may have the attribute novalidate on it, something like this:
<form action="/cart" method="post" novalidate class="cart__form">
Remove the novalidate attribute from your form and try it again.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025