woocommerce_coupon_get_items_to_apply
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.
Использование
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(массив)
- The items that the coupon will be applied to.
- $coupon(WC_Coupon)
- The coupon object.
- $that(WC_Discounts)
- The discounts instance.
Список изменений
| С версии 8.8.0 | Введена. |
Где вызывается хук
woocommerce_coupon_get_items_to_apply
woocommerce/includes/class-wc-discounts.php 351
return apply_filters( 'woocommerce_coupon_get_items_to_apply', $items_to_apply, $coupon, $this );