Automattic\WooCommerce\Blocks\BlockTypes

CouponCode::get_coupon_codeprivateWC 1.0

Extract coupon code from attributes.

Method of the class: CouponCode{}

No Hooks.

Returns

String.

Usage

// private - for code of main (parent) class only
$result = $this->get_coupon_code( $attributes ): string;
$attributes(array) (required)
Block attributes.

CouponCode::get_coupon_code() code WC 10.8.1

private function get_coupon_code( array $attributes ): string {
	$coupon_code = $attributes['couponCode'] ?? '';
	return is_string( $coupon_code ) ? $coupon_code : '';
}