WooCommerce Code Reference

AbstractLineItemSchema extends AbstractSchema
in package

AbstractLineItemSchema class.

Table of Contents

IDENTIFIER  = ''
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 the 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

VIEW_EDIT_CONTEXT

Context for the item schema - view and edit only.

public array<string|int, mixed> VIEW_EDIT_CONTEXT = array('view', 'edit')
Tags
since
10.2.0

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
since
10.2.0

Methods

get_item_response()

Get the item response.

public abstract get_item_response(mixed $item, WP_REST_Request $request[, array<string|int, mixed> $include_fields = array() ]) : array<string|int, mixed>
Parameters
$item : mixed

WordPress representation of the item.

$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>The item response.

get_item_schema()

Get the item schema.

public get_item_schema() : array<string|int, mixed>
Tags
since
10.2.0
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>
Tags
since
10.2.0
Return values
array<string|int, mixed>The schema properties.

get_writable_item_schema_properties()

Return all writable properties for the item schema.

public get_writable_item_schema_properties() : array<string|int, mixed>
Tags
since
10.2.0
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
since
10.2.0
Return values
boolTrue if the property is writable, false otherwise.

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.

Return values
array<string|int, mixed>