Checkout fields validation doesn’t work after update
-
After updating Woocommerce to 3.2.6 this code below stopped working. Before it was working fine. Can you please advice? Is the name of hook checkout process changed? I tried to output something at the beginning and I think it never reached my function.
Also I’m using child theme, could that cause the problem? Once again this was working fine before updating!
Thanks!!!add_action('woocommerce_checkout_process', 'wp_delivery_date_validation'); function wp_delivery_date_validation() { date_default_timezone_set('America/Los_Angeles'); $shipping_date = filter_input(INPUT_POST, 'shipping_date'); $shipping_time = filter_input(INPUT_POST, 'shipping_time'); $st = ""; preg_match("/^(\d{1,2}):00 ([AP])M$/", $shipping_time, $st); $time = $st[2]=='P'?(int)$st[1]+12:(int)$st[1]; $date = date('Y-m-d',strtotime($shipping_date)); if (($date == date('Y-m-d', strtotime(date('Y-m-d',time()) . "+1 day")) && $time < 12) || $date < date('Y-m-d', strtotime(date('Y-m-d',time()) . "+1 day"))) { wc_add_notice(__('<strong>Delivery Date</strong> must be at least 1 day in advance.'), 'error'); } }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Checkout fields validation doesn’t work after update’ is closed to new replies.