woocommerce_apply_with_individual_use_coupon
Filters if a coupon can be applied alongside other individual use coupons.
Usage
add_filter( 'woocommerce_apply_with_individual_use_coupon', 'wp_kama_woocommerce_apply_with_individual_use_coupon_filter', 10, 4 ); /** * Function for `woocommerce_apply_with_individual_use_coupon` filter-hook. * * @param boolean $apply_with_individual_use_coupon Defaults to false. * @param \WC_Coupon $coupon Coupon object applied to the cart. * @param \WC_Coupon $individual_use_coupon Individual use coupon already applied to the cart. * @param array $applied_coupons Array of applied coupons already applied to the cart. * * @return boolean */ function wp_kama_woocommerce_apply_with_individual_use_coupon_filter( $apply_with_individual_use_coupon, $coupon, $individual_use_coupon, $applied_coupons ){ // filter... return $apply_with_individual_use_coupon; }
- $apply_with_individual_use_coupon(true|false)
- Defaults to false.
- $coupon(\WC_Coupon)
- Coupon object applied to the cart.
- $individual_use_coupon(\WC_Coupon)
- Individual use coupon already applied to the cart.
- $applied_coupons(array)
- Array of applied coupons already applied to the cart.
Changelog
Since 2.6.0 | Introduced. |
Where the hook is called
woocommerce_apply_with_individual_use_coupon
woocommerce_apply_with_individual_use_coupon
woocommerce/src/StoreApi/Utilities/CartController.php 1020
if ( false === apply_filters( 'woocommerce_apply_with_individual_use_coupon', false, $coupon, $individual_use_coupon, $applied_coupons ) ) {
woocommerce/includes/class-wc-cart.php 1785
if ( $coupon->get_individual_use() && false === apply_filters( 'woocommerce_apply_with_individual_use_coupon', false, $the_coupon, $coupon, $this->applied_coupons ) ) {