Automattic\WooCommerce\StoreApi\Routes\V1
CartAddItem::get_args
Get method arguments for this REST route.
Метод класса: CartAddItem{}
Хуков нет.
Возвращает
Массив. An array of endpoints.
Использование
$CartAddItem = new CartAddItem(); $CartAddItem->get_args();
Код CartAddItem::get_args() CartAddItem::get args WC 10.4.3
public function get_args() {
return [
[
'methods' => \WP_REST_Server::CREATABLE,
'callback' => [ $this, 'get_response' ],
'permission_callback' => '__return_true',
'args' => [
'id' => [
'description' => __( 'The cart item product or variation ID.', 'woocommerce' ),
'type' => 'integer',
'context' => [ 'view', 'edit' ],
'sanitize_callback' => 'absint',
],
'quantity' => [
'description' => __( 'Quantity of this item to add to the cart.', 'woocommerce' ),
'type' => 'number',
'context' => [ 'view', 'edit' ],
'arg_options' => [
'sanitize_callback' => 'wc_stock_amount',
],
],
'variation' => [
'description' => __( 'Chosen attributes (for variations).', 'woocommerce' ),
'type' => 'array',
'context' => [ 'view', 'edit' ],
'items' => [
'type' => 'object',
'properties' => [
'attribute' => [
'description' => __( 'Variation attribute name.', 'woocommerce' ),
'type' => 'string',
'context' => [ 'view', 'edit' ],
],
'value' => [
'description' => __( 'Variation attribute value.', 'woocommerce' ),
'type' => 'string',
'context' => [ 'view', 'edit' ],
],
],
],
],
],
],
'schema' => [ $this->schema, 'get_public_item_schema' ],
'allow_batch' => [ 'v1' => true ],
];
}