Automattic\WooCommerce\Internal\RestApi\Routes\V4\ShippingZones
ShippingZoneSchema::get_item_schema_properties
Return all properties for the item schema.
Method of the class: ShippingZoneSchema{}
No Hooks.
Returns
Array.
Usage
$ShippingZoneSchema = new ShippingZoneSchema(); $ShippingZoneSchema->get_item_schema_properties(): array;
ShippingZoneSchema::get_item_schema_properties() ShippingZoneSchema::get item schema properties code WC 10.4.3
public function get_item_schema_properties(): array {
$schema = array(
'id' => array(
'description' => __( 'Unique identifier for the shipping zone.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit' ),
'readonly' => true,
),
'name' => array(
'description' => __( 'Shipping zone name.', 'woocommerce' ),
'type' => 'string',
'context' => array( 'view', 'edit' ),
'required' => true,
'sanitize_callback' => 'sanitize_text_field',
),
'order' => array(
'description' => __( 'Shipping zone order.', 'woocommerce' ),
'type' => 'integer',
'context' => array( 'view', 'edit' ),
'default' => 0,
),
'locations' => array(
'description' => __( 'Array of locations for this zone. Can be empty array but must be explicitly provided.', 'woocommerce' ),
'type' => 'array',
'context' => array( 'view', 'edit' ),
'required' => true,
'items' => array(
'type' => 'object',
'properties' => array(
'code' => array(
'description' => __( 'Shipping zone location code.', 'woocommerce' ),
'type' => 'string',
),
'type' => array(
'description' => __( 'Shipping zone location type.', 'woocommerce' ),
'type' => 'string',
'default' => 'country',
),
'name' => array(
'description' => __( 'Shipping zone location name (readonly, auto-generated from code).', 'woocommerce' ),
'type' => 'string',
'readonly' => true,
),
),
),
),
'methods' => array(
'description' => __( 'Shipping methods for this zone.', 'woocommerce' ),
'type' => 'array',
'readonly' => true,
'items' => array(
'type' => 'object',
'properties' => array(
'instance_id' => array(
'description' => __( 'Shipping method instance ID.', 'woocommerce' ),
'type' => 'integer',
),
'title' => array(
'description' => __( 'Shipping method title.', 'woocommerce' ),
'type' => 'string',
),
'enabled' => array(
'description' => __( 'Whether the shipping method is enabled.', 'woocommerce' ),
'type' => 'boolean',
),
'method_id' => array(
'description' => __( 'Shipping method ID (e.g., flat_rate, free_shipping).', 'woocommerce' ),
'type' => 'string',
),
'settings' => array(
'description' => __( 'Raw shipping method settings for frontend processing.', 'woocommerce' ),
'type' => 'object',
),
),
),
),
);
return $schema;
}