Automattic\WooCommerce\Blocks\BlockTypes

CouponCode::get_coupon_codeprivateWC 1.0

Extract coupon code from attributes.

Метод класса: CouponCode{}

Хуков нет.

Возвращает

Строку.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_coupon_code( $attributes ): string;
$attributes(массив) (обязательный)
Block attributes.

Код CouponCode::get_coupon_code() WC 11.0.1

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