Introduce woocommerce_order_applied_coupon hook (#35616)

Co-authored-by: Néstor Soriano <konamiman@konamiman.com>
Closes https://github.com/woocommerce/woocommerce/issues/34473
This commit is contained in:
Kathy 2022-11-28 10:19:33 -05:00 committed by GitHub
parent 9fabda744a
commit 185d3337ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 0 deletions

View File

@ -0,0 +1,4 @@
Significance: patch
Type: add
Add the woocommerce_order_applied_coupon hook

View File

@ -1211,6 +1211,16 @@ abstract class WC_Abstract_Order extends WC_Abstract_Legacy_Order {
}
}
/**
* Action to signal that a coupon has been applied to an order.
*
* @param WC_Coupon $coupon The applied coupon object.
* @param WC_Order $order The current order object.
*
* @since 7.3
*/
do_action( 'woocommerce_order_applied_coupon', $coupon, $this );
$this->set_coupon_discount_amounts( $discounts );
$this->save();