---
title: "cartItemSelect"
description: "商品选中以及反选接口"
doc_type: graphql
doc_category: storefront
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/zh-hans-cn/docs/storefront-api/cart/mutations/cart-item-select'
  md: 'https://developer.shopline.com/zh-hans-cn/docs/storefront-api/cart/mutations/cart-item-select.md'
---
# cartItemSelect

商品选中以及反选接口

- **Required Scopes:** `unauthenticated_read_cart`, `unauthenticated_write_cart`
- **API Version:** v20270301
- **API Type:** Storefront
- **API Protocol:** GraphQL
- **Operation Type:** Mutation

## Type Signature

`CartItemSelectPayload`

## Required Permissions

* `unauthenticated_read_cart`
* `unauthenticated_write_cart`

接口访问需要令牌，具体如何获取令牌请参考：[身份认证](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/storefront-api/overview.md)

## Arguments

* `input`

  [CartItemSelectInput](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/cart/inputs/cart-item-select-input.md)

  入参

## Returns

* `cart`

  [Cart](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/cart/objects/cart.md)

  购物车

* `userErrors`

  [[CartUserError]](https://developer.shopline.com/zh-hans-cn/docs/storefront-api/cart/objects/cart-user-error.md)

  错误信息列表

## Code Example

```graphql
mutation cartItemSelect($input: CartItemSelectInput ) {
	cartItemSelect(input: $input ) 
		 {
			# CartItemSelectPayload fields
		}
		
	}

```

## Variables

```json
{
  "input": {
    "cartId": {},
    "countryCode": "",
    "isNeedReturnCartDetail": {},
    "language": "",
    "selectItems": {
      "id": "",
      "select": false,
      "variantId": ""
    },
    "userToken": {}
  }
}
```

## Error Handling

关于更多通用错误码说明，参考：[状态码和错误码](https://developer.shopline.com/zh-hans-cn/docs/apps/api-instructions-for-use/storefront-api/overview.md#status-and-error-codes)。

