Add coupon usage count hooks
These action hooks allow developers to extend functionality related to updating coupon usage counts.
This commit is contained in:
parent
8d6bbabc58
commit
e2cc3673b2
|
@ -291,6 +291,9 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat
|
|||
add_post_meta( $coupon->get_id(), '_used_by', strtolower( $used_by ) );
|
||||
$coupon->set_used_by( (array) get_post_meta( $coupon->get_id(), '_used_by' ) );
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_increase_coupon_usage_count', $coupon, $new_count, $used_by );
|
||||
|
||||
return $new_count;
|
||||
}
|
||||
|
||||
|
@ -316,6 +319,9 @@ class WC_Coupon_Data_Store_CPT extends WC_Data_Store_WP implements WC_Coupon_Dat
|
|||
$coupon->set_used_by( (array) get_post_meta( $coupon->get_id(), '_used_by' ) );
|
||||
}
|
||||
}
|
||||
|
||||
do_action( 'woocommerce_decrease_coupon_usage_count', $coupon, $new_count, $used_by );
|
||||
|
||||
return $new_count;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue