Add a filter for the items to apply coupons array. (#45791)
* Add a filter for the items to apply coupons array. * Add changefile(s) from automation for the following project(s): woocommerce * Add filter docbloc. * Add since tag in filter docbloc. --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
2403baca01
commit
b3a1d8c922
|
@ -0,0 +1,4 @@
|
|||
Significance: minor
|
||||
Type: tweak
|
||||
|
||||
WC_Discount: Add a filter for the items to apply coupons array.
|
|
@ -333,7 +333,20 @@ class WC_Discounts {
|
|||
|
||||
$items_to_apply[] = $item_to_apply;
|
||||
}
|
||||
return $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.
|
||||
*
|
||||
* @since 8.8.0
|
||||
* @param array $items_to_apply The items that the coupon will be applied to.
|
||||
* @param WC_Coupon $coupon The coupon object.
|
||||
* @param WC_Discounts $this The discounts instance.
|
||||
*
|
||||
* @return array The modified list of items that the coupon should be applied to.
|
||||
*/
|
||||
return apply_filters( 'woocommerce_coupon_get_items_to_apply', $items_to_apply, $coupon, $this );
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue