WooCommerce Code Reference

ShippingZoneSchema extends AbstractSchema
in package

ShippingZoneSchema class.

Table of Contents

IDENTIFIER  = 'shipping_zone'
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_formatted_zone_locations()  : array<string|int, mixed>
Get array of location names for display.
get_formatted_zone_methods()  : array<string|int, mixed>
Get formatted methods for a zone.
get_location_name()  : string
Get location name from location object.
get_method_settings()  : array<string|int, mixed>
Get raw method settings for frontend processing.

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 get_item_response(WC_Shipping_Zone $zone, WP_REST_Request $request[, array<string|int, mixed> $include_fields = array() ]) : array<string|int, mixed>
Parameters
$zone : WC_Shipping_Zone

WordPress representation of the zone.

$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_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.

get_formatted_zone_locations()

Get array of location names for display.

protected get_formatted_zone_locations(WC_Shipping_Zone $zone[, string $view = 'summary' ]) : array<string|int, mixed>
Parameters
$zone : WC_Shipping_Zone

Shipping zone object.

$view : string = 'summary'

The view for which the API is requested ('summary' or 'detailed').

Return values
array<string|int, mixed>

get_method_settings()

Get raw method settings for frontend processing.

protected get_method_settings(object $method) : array<string|int, mixed>
Parameters
$method : object

Shipping method object.

Return values
array<string|int, mixed>