-
-
Save drabbytux/146f94af885141f65ea6998c64fcbcaf to your computer and use it in GitHub Desktop.
Cart Attributes: datepicker https://docs.shopify.com/themes/customization/cart/add-date-picker-for-delivery-dates
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{{ '//code.jquery.com/ui/1.9.2/themes/base/jquery-ui.css' | stylesheet_tag }} | |
{{ '//ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js' | script_tag }} | |
<div style="width:300px; clear:both;"> | |
<p> | |
<label for="date">Pick a delivery date:</label> | |
<input id="date" type="text" name="attributes[date]" value="{{ cart.attributes.date }}" /> | |
<span style="display:block" class="instructions"> We do not deliver during the week-end.</span> | |
</p> | |
</div> | |
<script> | |
jQuery(function() { | |
jQuery("#date").datepicker( { | |
minDate: +1, | |
maxDate: '+2M', | |
beforeShowDay: jQuery.datepicker.noWeekends | |
} ); | |
}); | |
</script> | |
{% comment %} | |
To remove days of the week that aren't Saturday and Sunday, use this: | |
http://stackoverflow.com/questions/2968414/disable-specific-days-of-the-week-on-jquery-ui-datepicker | |
{% endcomment %} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment