WC_Order_Refund::apply_coupon │ public │ WC 11.3.0

Coupons cannot be applied to refunds, so a refund never records coupon usage.

Method of the class: WC_Order_Refund{}

No Hooks.

Returns

WP_Error.

Usage

$WC_Order_Refund = new WC_Order_Refund();
$WC_Order_Refund->apply_coupon( $raw_coupon );
$raw_coupon(string|WC_Coupon) (required)
Coupon code or object.

Changelog

Since 11.3.0 Introduced.

WC_Order_Refund::apply_coupon() code WC 11.3.0

public function apply_coupon( $raw_coupon ) {
	return new WP_Error( 'invalid_coupon', __( 'Coupons cannot be applied to refunds.', 'woocommerce' ) );
}