WordPress at Your Fingertips
function is not described

Automattic\WooCommerce\Blocks\StoreApi\Schemas

CartCouponSchema::get_properties() public WC 1.0

Cart schema properties.

{} It's a method of the class: CartCouponSchema{}

No Hooks.

Return

Array.

Usage

$CartCouponSchema = new CartCouponSchema();
$CartCouponSchema->get_properties();

Code of CartCouponSchema::get_properties() WC 5.8.0

public function get_properties() {
	return [
		'code'          => [
			'description' => __( 'The coupon\'s unique code.', 'woocommerce' ),
			'type'        => 'string',
			'context'     => [ 'view', 'edit' ],
			'arg_options' => [
				'sanitize_callback' => 'wc_format_coupon_code',
				'validate_callback' => [ $this, 'coupon_exists' ],
			],
		],
		'discount_type' => [
			'description' => __( 'The discount type for the coupon (e.g. percentage or fixed amount)', 'woocommerce' ),
			'type'        => 'string',
			'context'     => [ 'view', 'edit' ],
			'arg_options' => [
				'validate_callback' => [ $this, 'coupon_exists' ],
			],
		],
		'totals'        => [
			'description' => __( 'Total amounts provided using the smallest unit of the currency.', 'woocommerce' ),
			'type'        => 'object',
			'context'     => [ 'view', 'edit' ],
			'readonly'    => true,
			'properties'  => array_merge(
				$this->get_store_currency_properties(),
				[
					'total_discount'     => [
						'description' => __( 'Total discount applied by this coupon.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => [ 'view', 'edit' ],
						'readonly'    => true,
					],
					'total_discount_tax' => [
						'description' => __( 'Total tax removed due to discount applied by this coupon.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => [ 'view', 'edit' ],
						'readonly'    => true,
					],
				]
			),
		],
	];
}