that is what i have now!.
theme/deliverHours.js:
Update
window.onload = function () {
getHour= new Date().toLocaleTimeString("en-US",{timeZone:"America/New_York",hour12: false});
getDay= new Date().toLocaleTimeString("en-US",{timeZone:"America/New_York",hour12: false,weekday:'short'});
day = getDay.split(' ');
arrayDate = getHour.split(':');
document.getElementById('shipping_method_0_local_pickup8').onclick=function() {
if(document.getElementById('shipping_method_0_local_pickup8').checked){
console.log('local Pickup!');
console.log(getDay);
if(!(arrayDate[0] >= 7 && arrayDate[0] <= 16 && day[0] == 'Sun')) {
document.getElementById('msg').innerHTML = "Sorry,We are Closed";
document.getElementById('checkOut').disabled = true
}else{
document.getElementById('checkOut').disabled = false
console.log('enjoy your food');
}
}
}
document.getElementById('shipping_method_0_flat_rate1').onclick=function(){
if(document.getElementById('shipping_method_0_flat_rate1').checked){
console.log('flat rate!');
console.log(getDay);
if(!(arrayDate[0] >= 7 && arrayDate[0] <= 16 && day[0] == 'Sun')) {
document.getElementById('msg').innerHTML = "sorry,we are closed. "
document.getElementById('checkOut').disabled = true
}else{
document.getElementById('checkOut').disabled = false
console.log('enjoy your food');
}
}
}
}
theme/function.php:
function deliver_business_hours(){
wp_register_script('deliverHours', plugins_url('deliverHours.js'), array(),'1.0', true);
wp_enqueue_script('deliverHours');
}
add_action( 'wp_enqueue_script', 'deliver_business_hours');
Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. this text is useless...
that should work right?.