【发布时间】:2018-04-21 09:33:26
【问题描述】:
这就是我现在所拥有的!。
主题/deliverHours.js:
更新
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');
}
}
}
}
主题/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 只是印刷和排版行业的虚拟文本。自 1500 年代以来,Lorem Ipsum 一直是行业的标准虚拟文本,当时一位不知名的印刷商采用了一种类型的厨房并将其加扰以制作类型样本书。这段文字没用……
应该可以吧?
【问题讨论】:
-
那么,您的问题/问题是什么?
-
好的,谢谢,我不知道我在做什么,我更改了代码,所以你知道我如何识别 local_pickup 或统一费率吗?
标签: javascript php wordpress