Timepicker Coding error?? Help!

JennyRen
New Member
1 0 0

I'm really new to coding and have no idea how I've got this far, I've managed to create/add two snippets one for Date picker and one for Time picker. I've added these into the product.liquid not the cart as I don't need this function on every order - just certain products.

I've got everything working perfectly, relevant dates and times greyed out etc - however, the date picker leaves the date the customer selects in the addiotnal notes of the order, perfect! however the timepicker does not, so when the order comes through i have no idea what time the customer has selected, I'm assuming there is a bit of code missing somewhere, the only difference between the snippets that I can see is  this line so i assume it is this, however i cant seem that to work anywhere - value="{{ cart.attributes.date }}" />

Scenario - customer orders item and selects 24/09/21 at 10.30 for collection, order comes to me and i see in 'additional details' on the order 24/09/21 but no time.

Here is the code that isn't speaking to the order confirmation page - actual selecting of timeslots is working - 

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script><link href="https://cdnjs.cloudflare.com/ajax/libs/jquery-timepicker/1.10.0/jquery.timepicker.min.css" rel="stylesheet"/>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-timepicker/1.10.0/jquery.timepicker.min.js"></script>

<label for="time">Please select a timeslot</label>

<input id="timepicker"
type="text"
class = "timepicker"
name="datetime"
required/>

<script>
$( document ).ready(function() {
$('input[name="datetime"]').timepicker({
minTime: '10:00am',
maxTime: '01:00pm',
step: 30, // 15 minutes
disableTimeRanges: [
['10:00am','10:30am'],['11:00am','11:30am'],
['12:30pm','1:00pm']
],

// showDuration: true
});
});
</script>

0 Likes