OrderFeeSchema
extends AbstractLineItemSchema
in package
OrderFeeSchema class.
Table of Contents
- IDENTIFIER = 'order-fee'
- The schema item identifier.
- VIEW_EDIT_CONTEXT = array('view', 'edit')
- Context for the item schema - view and edit only.
- VIEW_EDIT_EMBED_CONTEXT = array('view', 'edit', 'embed')
- Context for the item schema - view, edit, and embed.
- get_item_response() : array<string|int, mixed>
- Get an item response.
- get_item_schema() : array<string|int, mixed>
- Get the item schema.
- get_item_schema_properties() : array<string|int, mixed>
- Return all properties for the item schema.
- get_writable_item_schema_properties() : array<string|int, mixed>
- Return all writable properties for the item schema.
- filter_writable_props() : bool
- Filter schema properties to only return writable ones.
- get_meta_data_schema() : array<string|int, mixed>
- Get the meta data schema shared by all line item schemas.
- get_taxes_schema() : array<string|int, mixed>
- Get the taxes schema shared by line item schemas.
- prepare_meta_data() : array<string|int, mixed>
- Prepare the meta data for the order item.
- prepare_taxes() : array<string|int, mixed>
- Prepare the taxes for the order item.
Constants
IDENTIFIER
The schema item identifier.
public
string
IDENTIFIER
= 'order-fee'
VIEW_EDIT_CONTEXT
Context for the item schema - view and edit only.
public
array<string|int, mixed>
VIEW_EDIT_CONTEXT
= array('view', 'edit')
Tags
VIEW_EDIT_EMBED_CONTEXT
Context for the item schema - view, edit, and embed.
public
array<string|int, mixed>
VIEW_EDIT_EMBED_CONTEXT
= array('view', 'edit', 'embed')
Tags
Methods
get_item_response()
Get an item response.
public
get_item_response(WC_Order_Item_Fee $order_item, WP_REST_Request $request[, array<string|int, mixed> $include_fields = array() ]) : array<string|int, mixed>
Parameters
- $order_item : WC_Order_Item_Fee
-
Order item instance.
- $request : WP_REST_Request
-
Request object.
- $include_fields : array<string|int, mixed> = array()
-
Fields to include in the response.
Return values
array<string|int, mixed> —get_item_schema()
Get the item schema.
public
get_item_schema() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> — The item schema.get_item_schema_properties()
Return all properties for the item schema.
public
get_item_schema_properties() : array<string|int, mixed>
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.
Return values
array<string|int, mixed> —get_writable_item_schema_properties()
Return all writable properties for the item schema.
public
get_writable_item_schema_properties() : array<string|int, mixed>
Tags
Return values
array<string|int, mixed> — The schema properties.filter_writable_props()
Filter schema properties to only return writable ones.
protected
filter_writable_props(array<string|int, mixed> $schema) : bool
Parameters
- $schema : array<string|int, mixed>
-
The schema property to check.
Tags
Return values
bool — True if the property is writable, false otherwise.get_meta_data_schema()
Get the meta data schema shared by all line item schemas.
protected
get_meta_data_schema() : array<string|int, mixed>
Return values
array<string|int, mixed> —get_taxes_schema()
Get the taxes schema shared by line item schemas.
protected
get_taxes_schema() : array<string|int, mixed>
Return values
array<string|int, mixed> —prepare_meta_data()
Prepare the meta data for the order item.
protected
prepare_meta_data(WC_Order_Item $order_item) : array<string|int, mixed>
Parameters
- $order_item : WC_Order_Item
-
Order item instance.
Return values
array<string|int, mixed> —prepare_taxes()
Prepare the taxes for the order item.
protected
prepare_taxes(WC_Order_Item_Product|WC_Order_Item_Fee $order_item, WP_REST_Request $request) : array<string|int, mixed>
Parameters
- $order_item : WC_Order_Item_Product|WC_Order_Item_Fee
-
Order item instance.
- $request : WP_REST_Request
-
Request object.
