Automattic\WooCommerce\Internal\RestApi\Routes\V4\Orders\Schema
OrderCouponSchema::get_item_schema_properties
Return all properties for the item schema.
Note that context determines under which context data should be visible. For example, edit would be the context used when getting records with the intent of editing them. embed context allows the data to be visible when the item is being embedded in another response.
Method of the class: OrderCouponSchema{}
No Hooks.
Returns
Array.
Usage
$OrderCouponSchema = new OrderCouponSchema(); $OrderCouponSchema->get_item_schema_properties(): array;
OrderCouponSchema::get_item_schema_properties() OrderCouponSchema::get item schema properties code WC 10.4.3
public function get_item_schema_properties(): array {
$schema = array(
'id' => array(
'description' => __( 'Item ID.', 'woocommerce' ),
'type' => 'integer',
'context' => self::VIEW_EDIT_EMBED_CONTEXT,
'readonly' => true,
),
'code' => array(
'description' => __( 'Coupon code.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_EMBED_CONTEXT,
'readonly' => true,
),
'discount' => array(
'description' => __( 'Discount total.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_EMBED_CONTEXT,
'readonly' => true,
),
'discount_tax' => array(
'description' => __( 'Discount total tax.', 'woocommerce' ),
'type' => 'string',
'context' => self::VIEW_EDIT_EMBED_CONTEXT,
'readonly' => true,
),
'discount_type' => array(
'description' => __( 'Discount type.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view' ),
'readonly' => true,
),
'nominal_amount' => array(
'description' => __( 'Discount amount as defined in the coupon (absolute value or a percent, depending on the discount type).', 'woocommerce' ),
'type' => 'number',
'context' => array( 'view' ),
'readonly' => true,
),
'free_shipping' => array(
'description' => __( 'Whether the coupon grants free shipping or not.', 'woocommerce' ),
'type' => 'boolean',
'context' => array( 'view' ),
'readonly' => true,
),
'meta_data' => $this->get_meta_data_schema(),
);
return $schema;
}