Automattic\WooCommerce\StoreApi\Schemas\V1

OrderCouponSchema::get_properties()publicWC 1.0

Cart schema properties.

Method of the class: OrderCouponSchema{}

No Hooks.

Return

Array.

Usage

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

OrderCouponSchema::get_properties() code WC 8.7.0

public function get_properties() {
	return [
		'code'          => [
			'description' => __( 'The coupons unique code.', 'woocommerce' ),
			'type'        => 'string',
			'context'     => [ 'view', 'edit' ],
			'readonly'    => true,
		],
		'discount_type' => [
			'description' => __( 'The discount type for the coupon (e.g. percentage or fixed amount)', 'woocommerce' ),
			'type'        => 'string',
			'context'     => [ 'view', 'edit' ],
			'readonly'    => true,
		],
		'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,
					],
				]
			),
		],
	];
}