Schedule Auto Apply of Woocommerce Coupon

function apply_matched_coupons() { global $woocommerce; $coupon_code = 'COUPONCODE'; // your coupon code here $dateStart = mktime(0, 0, 0, 11, 28, 2016); $dateEnd = mktime(0, 0, 0, 11, 29, 2016); if (time() < $cybermondaydateEnd && time() > $dateStart){ $woocommerce->cart->add_discount( $coupon_code ); } } add_action( 'woocommerce_before_cart', 'apply_matched_coupons' );
Using a PHP date range to auto apply a Woocommerce coupon.

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.