woocommerce_apply_individual_use_coupon хук-фильтрWC 1.0

Filter coupons to remove when applying an individual use coupon.

Использование

add_filter( 'woocommerce_apply_individual_use_coupon', 'wp_kama_woocommerce_apply_individual_use_coupon_filter', 10, 3 );

/**
 * Function for `woocommerce_apply_individual_use_coupon` filter-hook.
 * 
 * @param array      $coupons         Array of coupons to remove from the cart.
 * @param \WC_Coupon $coupon          Coupon object applied to the cart.
 * @param array      $applied_coupons Array of applied coupons already applied to the cart.
 *
 * @return array
 */
function wp_kama_woocommerce_apply_individual_use_coupon_filter( $coupons, $coupon, $applied_coupons ){

	// filter...
	return $coupons;
}
$coupons(массив)
Array of coupons to remove from the cart.
$coupon(\WC_Coupon)
Coupon object applied to the cart.
$applied_coupons(массив)
Array of applied coupons already applied to the cart.

Где вызывается хук

CartController::apply_coupon()
woocommerce_apply_individual_use_coupon
WC_Cart::apply_coupon()
woocommerce_apply_individual_use_coupon
woocommerce/packages/woocommerce-blocks/src/StoreApi/Utilities/CartController.php 997
$coupons_to_remove = array_diff( $applied_coupons, apply_filters( 'woocommerce_apply_individual_use_coupon', array(), $coupon, $applied_coupons ) );
woocommerce/includes/class-wc-cart.php 1747
$coupons_to_keep = apply_filters( 'woocommerce_apply_individual_use_coupon', array(), $the_coupon, $this->applied_coupons );

Где используется хук в WooCommerce

Использование не найдено.