Automattic\WooCommerce\StoreApi\Routes\V1

ShopperListItems::get_argspublicWC 1.0

Get method arguments for this REST route.

Method of the class: ShopperListItems{}

No Hooks.

Returns

Array.

Usage

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

ShopperListItems::get_args() code WC 10.9.1

public function get_args() {
	return array(
		'args'   => array(
			'slug' => array(
				'description' => __( 'Stable slug for the list.', 'woocommerce' ),
				'type'        => 'string',
			),
		),
		array(
			'methods'             => \WP_REST_Server::READABLE,
			'callback'            => array( $this, 'get_response' ),
			'permission_callback' => function () {
				return is_user_logged_in();
			},
			'args'                => array(
				'context' => $this->get_context_param( array( 'default' => 'view' ) ),
			),
		),
		array(
			'methods'             => \WP_REST_Server::CREATABLE,
			'callback'            => array( $this, 'get_response' ),
			'permission_callback' => function () {
				return is_user_logged_in();
			},
			'args'                => array(
				'cart_item_key' => array(
					'description' => __( 'Existing cart item key to copy into the list.', 'woocommerce' ),
					'type'        => 'string',
				),
				'product_id'    => array(
					'description' => __( 'Product or variation ID to save. Required when cart_item_key is not supplied.', 'woocommerce' ),
					'type'        => 'integer',
				),
				'variation'     => array(
					'description' => __( 'Chosen attributes (for variations).', 'woocommerce' ),
					'type'        => 'array',
					'context'     => array( 'view', 'edit' ),
					'items'       => array(
						'type'       => 'object',
						'properties' => array(
							'attribute' => array(
								'description' => __( 'Variation attribute name.', 'woocommerce' ),
								'type'        => 'string',
								'context'     => array( 'view', 'edit' ),
							),
							'value'     => array(
								'description' => __( 'Variation attribute value.', 'woocommerce' ),
								'type'        => 'string',
								'context'     => array( 'view', 'edit' ),
							),
						),
					),
				),
				'quantity'      => array(
					'description' => __( 'Quantity for the saved item.', 'woocommerce' ),
					'type'        => 'integer',
					'default'     => 1,
				),
			),
		),
		'schema' => array( $this->schema, 'get_public_item_schema' ),
	);
}