Automattic\WooCommerce\StoreApi\Schemas\V1

CartShippingRateSchema::get_rate_properties()protectedWC 1.0

Schema for a single rate.

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

Хуков нет.

Возвращает

Массив.

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

// protected - в коде основоного (родительского) или дочернего класса
$result = $this->get_rate_properties();

Код CartShippingRateSchema::get_rate_properties() WC 8.7.0

protected function get_rate_properties() {
	return array_merge(
		[
			'rate_id'       => [
				'description' => __( 'ID of the shipping rate.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => [ 'view', 'edit' ],
				'readonly'    => true,
			],
			'name'          => [
				'description' => __( 'Name of the shipping rate, e.g. Express shipping.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => [ 'view', 'edit' ],
				'readonly'    => true,
			],
			'description'   => [
				'description' => __( 'Description of the shipping rate, e.g. Dispatched via USPS.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => [ 'view', 'edit' ],
				'readonly'    => true,
			],
			'delivery_time' => [
				'description' => __( 'Delivery time estimate text, e.g. 3-5 business days.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => [ 'view', 'edit' ],
				'readonly'    => true,
			],
			'price'         => [
				'description' => __( 'Price of this shipping rate using the smallest unit of the currency.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => [ 'view', 'edit' ],
				'readonly'    => true,
			],
			'taxes'         => [
				'description' => __( 'Taxes applied to this shipping rate using the smallest unit of the currency.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => [ 'view', 'edit' ],
				'readonly'    => true,
			],
			'method_id'     => [
				'description' => __( 'ID of the shipping method that provided the rate.', 'woocommerce' ),
				'type'        => 'string',
				'context'     => [ 'view', 'edit' ],
				'readonly'    => true,
			],
			'instance_id'   => [
				'description' => __( 'Instance ID of the shipping method that provided the rate.', 'woocommerce' ),
				'type'        => 'integer',
				'context'     => [ 'view', 'edit' ],
				'readonly'    => true,
			],
			'meta_data'     => [
				'description' => __( 'Meta data attached to the shipping rate.', 'woocommerce' ),
				'type'        => 'array',
				'context'     => [ 'view', 'edit' ],
				'items'       => [
					'type'       => 'object',
					'properties' => [
						'key'   => [
							'description' => __( 'Meta key.', 'woocommerce' ),
							'type'        => 'string',
							'context'     => [ 'view', 'edit' ],
							'readonly'    => true,
						],
						'value' => [
							'description' => __( 'Meta value.', 'woocommerce' ),
							'type'        => 'string',
							'context'     => [ 'view', 'edit' ],
							'readonly'    => true,
						],
					],
				],
			],
			'selected'      => [
				'description' => __( 'True if this is the rate currently selected by the customer for the cart.', 'woocommerce' ),
				'type'        => 'boolean',
				'context'     => [ 'view', 'edit' ],
				'readonly'    => true,
			],
		],
		$this->get_store_currency_properties()
	);
}