woocommerce_coupon_get_items_to_apply filter-hookWC 8.8.0

Filters the items that a coupon should be applied to.

This filter allows you to modify the items that a coupon will be applied to before the discount calculations take place.

Usage

add_filter( 'woocommerce_coupon_get_items_to_apply', 'wp_kama_woocommerce_coupon_get_items_to_apply_filter', 10, 3 );

/**
 * Function for `woocommerce_coupon_get_items_to_apply` filter-hook.
 * 
 * @param array        $items_to_apply The items that the coupon will be applied to.
 * @param WC_Coupon    $coupon         The coupon object.
 * @param WC_Discounts $that           The discounts instance.
 *
 * @return array
 */
function wp_kama_woocommerce_coupon_get_items_to_apply_filter( $items_to_apply, $coupon, $that ){

	// filter...
	return $items_to_apply;
}
$items_to_apply(array)
The items that the coupon will be applied to.
$coupon(WC_Coupon)
The coupon object.
$that(WC_Discounts)
The discounts instance.

Changelog

Since 8.8.0 Introduced.

Where the hook is called

WC_Discounts::get_items_to_apply_coupon()
woocommerce_coupon_get_items_to_apply
woocommerce/includes/class-wc-discounts.php 350
return apply_filters( 'woocommerce_coupon_get_items_to_apply', $items_to_apply, $coupon, $this );

Where the hook is used in WooCommerce

Usage not found.