Need Help in Time Slot WordPress
-
Hello Developers,
I am again stucking in a problem!!
i have created my wordpress website 4 months ago and the upper mentioned topic helped me alot
not my client turned out new senario:they are saying that in website user can not order from night(10:30 pm) to morning (9:00
am) Pakistan Standard Time.i used this following code:
function add_the_date_validation( $passed, $product_id, $quantity ) {
$passed = true;
date_default_timezone_set(“Asia/Karachi”);$day = date(‘l’);
$time = strtotime(date(‘h:i’));
$lunchstarttime_a = strtotime(“10:30”);
$lunchendtime_a = strtotime(“09:05”);$dinnerstarttime = strtotime(“10:30”);
$dinnerendtime = strtotime(“09:05”);//Check for Lunch
if($selected == “Lunch”)
{
if($time < $lunchstarttime_a && $time < $lunchendtime_a)
{$passed = false;
}
if(!$passed)
{
wc_add_notice( __( ‘SORRY! YOU CANNOT ORDER FOR LUNCH & DINNER IN BETWEEN 10:30 PM TO 9 AM DUE TO MEAL BOX OPERATIONAL HOURS.THANK YOU FOR YOUR PATIENCE!.’, ‘woocommerce’ ), ‘error’ );
}
}
}according to my senario any user/ customer should not order after 10:30 night and 9:05 morning
please help me we are running out of time
regards,
asad
- The topic ‘Need Help in Time Slot WordPress’ is closed to new replies.