Automattic\WooCommerce\StoreApi\Routes\V1

CartItemsByKey::get_args │ public │ WC 1.0

Get method arguments for this REST route.

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

Хуков нет.

Возвращает

array. An array of endpoints.

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

$CartItemsByKey = new CartItemsByKey();
$CartItemsByKey->get_args();

Код CartItemsByKey::get_args() WC 11.3.0

public function get_args() {
	return [
		'args'        => [
			'key' => [
				'description' => __( 'Unique identifier for the item within the cart.', 'woocommerce' ),
				'type'        => 'string',
			],
		],
		[
			'methods'             => \WP_REST_Server::READABLE,
			'callback'            => [ $this, 'get_response' ],
			'permission_callback' => '__return_true',
			'args'                => [
				'context' => $this->get_context_param( [ 'default' => 'view' ] ),
			],
		],
		[
			'methods'             => \WP_REST_Server::EDITABLE,
			'callback'            => array( $this, 'get_response' ),
			'permission_callback' => '__return_true',
			'args'                => array_merge(
				$this->schema->get_endpoint_args_for_item_schema( \WP_REST_Server::EDITABLE ),
				[
					// Manually add quantity so it gets validated.
					'quantity' => [
						'description' => __( 'New quantity of the item in the cart.', 'woocommerce' ),
						'type'        => 'number',
					],
				]
			),
		],
		[
			'methods'             => \WP_REST_Server::DELETABLE,
			'callback'            => [ $this, 'get_response' ],
			'permission_callback' => '__return_true',
		],
		'schema'      => [ $this->schema, 'get_public_item_schema' ],
		'allow_batch' => [ 'v1' => true ],
	];
}