Automattic\WooCommerce\StoreApi\Schemas\V1

CartShippingRateSchema::get_properties()publicWC 1.0

Cart schema properties.

Метод класса: CartShippingRateSchema{}

Хуков нет.

Возвращает

Массив.

Использование

$CartShippingRateSchema = new CartShippingRateSchema();
$CartShippingRateSchema->get_properties();

Код CartShippingRateSchema::get_properties() WC 8.7.0

public function get_properties() {
	return [
		'package_id'     => [
			'description' => __( 'The ID of the package the shipping rates belong to.', 'woocommerce' ),
			'type'        => [ 'integer', 'string' ],
			'context'     => [ 'view', 'edit' ],
			'readonly'    => true,
		],
		'name'           => [
			'description' => __( 'Name of the package.', 'woocommerce' ),
			'type'        => 'string',
			'context'     => [ 'view', 'edit' ],
			'readonly'    => true,
		],
		'destination'    => [
			'description' => __( 'Shipping destination address.', 'woocommerce' ),
			'type'        => 'object',
			'context'     => [ 'view', 'edit' ],
			'readonly'    => true,
			'properties'  => [
				'address_1' => [
					'description' => __( 'First line of the address being shipped to.', 'woocommerce' ),
					'type'        => 'string',
					'context'     => [ 'view', 'edit' ],
					'readonly'    => true,
				],
				'address_2' => [
					'description' => __( 'Second line of the address being shipped to.', 'woocommerce' ),
					'type'        => 'string',
					'context'     => [ 'view', 'edit' ],
					'readonly'    => true,
				],
				'city'      => [
					'description' => __( 'City of the address being shipped to.', 'woocommerce' ),
					'type'        => 'string',
					'context'     => [ 'view', 'edit' ],
					'readonly'    => true,
				],
				'state'     => [
					'description' => __( 'ISO code, or name, for the state, province, or district of the address being shipped to.', 'woocommerce' ),
					'type'        => 'string',
					'context'     => [ 'view', 'edit' ],
					'readonly'    => true,
				],
				'postcode'  => [
					'description' => __( 'Zip or Postcode of the address being shipped to.', 'woocommerce' ),
					'type'        => 'string',
					'context'     => [ 'view', 'edit' ],
					'readonly'    => true,
				],
				'country'   => [
					'description' => __( 'ISO code for the country of the address being shipped to.', 'woocommerce' ),
					'type'        => 'string',
					'context'     => [ 'view', 'edit' ],
					'readonly'    => true,
				],
			],
		],
		'items'          => [
			'description' => __( 'List of cart items the returned shipping rates apply to.', 'woocommerce' ),
			'type'        => 'array',
			'context'     => [ 'view', 'edit' ],
			'readonly'    => true,
			'items'       => [
				'type'       => 'object',
				'properties' => [
					'key'      => [
						'description' => __( 'Unique identifier for the item within the cart.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => [ 'view', 'edit' ],
						'readonly'    => true,
					],
					'name'     => [
						'description' => __( 'Name of the item.', 'woocommerce' ),
						'type'        => 'string',
						'context'     => [ 'view', 'edit' ],
						'readonly'    => true,
					],
					'quantity' => [
						'description' => __( 'Quantity of the item in the current package.', 'woocommerce' ),
						'type'        => 'number',
						'context'     => [ 'view', 'edit' ],
						'readonly'    => true,
					],
				],
			],
		],
		'shipping_rates' => [
			'description' => __( 'List of shipping rates.', 'woocommerce' ),
			'type'        => 'array',
			'context'     => [ 'view', 'edit' ],
			'readonly'    => true,
			'items'       => [
				'type'       => 'object',
				'properties' => $this->get_rate_properties(),
			],
		],
	];
}