How to Enable/Disable a rule programatically and check its status
-
Hi, is there a simple hook or method I can call to enable or disable a rule? And is there one to check on the rule’s status (enabled or disabled)?
For example, I want to extend a sale on a certain category of items if someone buys one of those items before a timer expires. Here’s what I’m thinking of doing:
on
woocommerce_payment_complete
…if ( ! $discount_is_active( $discount_ID ) ) { return; } if ( $order_contains_my_category ) { // reset timer }
on
timer_expire
…disable_discount( $discount_ID )
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘How to Enable/Disable a rule programatically and check its status’ is closed to new replies.