> This page is for Developer.

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.bigcommerce.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.bigcommerce.com/_mcp/server.

# Update Shopping List

PUT https://api-b2b.bigcommerce.com/api/v3/io/shopping-list/{shoppingListId}
Content-Type: application/json

update a shopping list detail. you can also update shopping list items by update the items field by this API endpoints. 
note: 
1. User id for update the shopping list is not required. You can optionally enter this field according to whether you need to judge user permissions.
2. The ID field in shopping list items is an optional field. If it is null, you can only change the quantity of this item by product ID, variant ID and option list, these three fields will determine an actual item. If it is not null, the ID field will determine an actual item and you can change product ID, variant ID, and option list by this way.
3. Set a zero quantity of shopping list item will delete this item.
4. Quantity = 0 will remove item, you can modify multiple items at one time.

Reference: https://docs.bigcommerce.com/developer/api-reference/rest/b2b/management/shopping-list/put-shopping-list-shopping-list-id

## Authentication

- `X-Auth-Token` header (required) — | Header | Argument | Description | |:-------|:---------|:------------| | `X-Auth-Token` | `access_token` | For more about API accounts that generate `access_token`s, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts). | For example requests and more information about authenticating BigCommerce APIs, see [Authentication and Example Requests](/developer/docs/overview/api-fundamentals/api-accounts#x-auth-token-header-example-requests). For more about BigCommerce OAuth scopes, see our [Guide to API Accounts](/developer/docs/overview/api-fundamentals/api-accounts#oauth-scopes). For a list of API status codes, see [API Status Codes](/developer/api-reference/rest/overview#rest-http-status-codes).
- `X-Store-Hash` header (required) — | Header | Argument | Description | |:-------|:---------|:------------| | `X-Store-Hash` | `store_hash` | The unique store hash associated with a BigCommerce store that has B2B Edition enabled. |

## Request

### Path parameters

- `shoppingListId` (integer, required) — The unique ID for a shopping list.

### Body (application/json)

This endpoint expects an object.

- `name` (string, optional) — name for shopping list
- `description` (string, optional) — description information for shopping list
- `status` (enum, optional) — status of shopping list, (0: approved, 20: deleted, 30: draft, 40: ready for approval)
  - Allowed values: `0`, `30`, `40`
- `userId` (integer, optional) — B2B Edition buyer user ID, you can enter a user ID to check if this user can update this shopping list.
- `customerId` (integer, optional) — BigCommerce customer ID, passing this parameter will obtain the shopping list according to the b2c user.
- `items` (list of ShoppingListShoppingListIdPutRequestBodyContentApplicationJsonSchemaItemsItems, optional)

## Response

### 200

OK

- `code` (integer, optional) — Response code of success request.
- `meta` (ShoppingListShoppingListIdPutResponsesContentApplicationJsonSchemaMeta, optional)
- `data` (ShoppingListShoppingListIdPutResponsesContentApplicationJsonSchemaData, optional)

## Errors

### 404 Not Found Error

Not Found Error

- `code` (double, optional) — Response status code
- `data` (ShoppingListShoppingListIdPutResponsesContentApplicationJsonSchemaData, optional) — Response data
- `meta` (ShoppingListShoppingListIdPutResponsesContentApplicationJsonSchemaMeta, optional)

### 422 Unprocessable Entity Error

Parameter Error

- `code` (double, required) — response status code
- `data` (ShoppingListShoppingListIdPutResponsesContentApplicationJsonSchemaData, required)
- `meta` (ShoppingListShoppingListIdPutResponsesContentApplicationJsonSchemaMeta, required)

## Types

### ShoppingListShoppingListIdPutRequestBodyContentApplicationJsonSchemaItemsItems

- `id` (integer, optional) — Unique ID field for shopping list item
- `productId` (integer, optional) — Product ID for shopping list item
- `variantId` (integer, optional) — Variant ID for shopping list item. If the product has options, the variant ID is required, otherwise it can be left blank.
- `quantity` (integer, optional) — Quantity of product and variant
- `sortOrder` (integer, optional) — The sort order for item
- `optionList` (ShoppingListShoppingListIdPutRequestBodyContentApplicationJsonSchemaItemsItemsOptionList, optional) — The optionlist does not need to be input in and will be automatically obtained based on productId and variantId.
- `productNote` (string, optional) — product note

### ShoppingListShoppingListIdPutResponsesContentApplicationJsonSchemaMeta

- `message` (string, required) — error information

### ShoppingListShoppingListIdPutResponsesContentApplicationJsonSchemaData

- `errMsg` (ShoppingListShoppingListIdPutResponsesContentApplicationJsonSchemaDataErrMsg, required) — Error detail information for some parameters.

### ShoppingListShoppingListIdPutRequestBodyContentApplicationJsonSchemaItemsItemsOptionList

The optionlist does not need to be input in and will be automatically obtained based on productId and variantId.

- `optionId` (string, optional)
- `optionValue` (string, optional)

### ShoppingListShoppingListIdPutResponsesContentApplicationJsonSchemaDataErrMsg

Error detail information for some parameters.

## Examples

**Request**

```json
{
  "name": "test",
  "description": "develop test",
  "status": 0,
  "userId": 223437,
  "items": [
    {
      "id": 75693,
      "productId": 107,
      "variantId": 73,
      "quantity": 0
    },
    {
      "id": 85416,
      "productId": 86,
      "variantId": 66,
      "quantity": 40
    },
    {
      "id": 76533,
      "productId": 112,
      "variantId": 79,
      "quantity": 1
    }
  ]
}
```

**Response**

```json
{
  "code": 200,
  "meta": {
    "message": "SUCCESS"
  },
  "data": {
    "channelId": 1,
    "channelName": "string",
    "companyId": 1,
    "createdAt": 1631495936,
    "description": "this is my first shopping list",
    "id": 1,
    "name": "my first shopping list",
    "status": 0,
    "updatedAt": 1631495936,
    "userId": 12
  }
}
```

**SDK Code**

```python example-1
import requests

url = "https://api-b2b.bigcommerce.com/api/v3/io/shopping-list/1"

payload = {
    "name": "test",
    "description": "develop test",
    "status": 0,
    "userId": 223437,
    "items": [
        {
            "id": 75693,
            "productId": 107,
            "variantId": 73,
            "quantity": 0
        },
        {
            "id": 85416,
            "productId": 86,
            "variantId": 66,
            "quantity": 40
        },
        {
            "id": 76533,
            "productId": 112,
            "variantId": 79,
            "quantity": 1
        }
    ]
}
headers = {
    "X-Auth-Token": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript example-1
const url = 'https://api-b2b.bigcommerce.com/api/v3/io/shopping-list/1';
const options = {
  method: 'PUT',
  headers: {'X-Auth-Token': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"name":"test","description":"develop test","status":0,"userId":223437,"items":[{"id":75693,"productId":107,"variantId":73,"quantity":0},{"id":85416,"productId":86,"variantId":66,"quantity":40},{"id":76533,"productId":112,"variantId":79,"quantity":1}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go example-1
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api-b2b.bigcommerce.com/api/v3/io/shopping-list/1"

	payload := strings.NewReader("{\n  \"name\": \"test\",\n  \"description\": \"develop test\",\n  \"status\": 0,\n  \"userId\": 223437,\n  \"items\": [\n    {\n      \"id\": 75693,\n      \"productId\": 107,\n      \"variantId\": 73,\n      \"quantity\": 0\n    },\n    {\n      \"id\": 85416,\n      \"productId\": 86,\n      \"variantId\": 66,\n      \"quantity\": 40\n    },\n    {\n      \"id\": 76533,\n      \"productId\": 112,\n      \"variantId\": 79,\n      \"quantity\": 1\n    }\n  ]\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("X-Auth-Token", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby example-1
require 'uri'
require 'net/http'

url = URI("https://api-b2b.bigcommerce.com/api/v3/io/shopping-list/1")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["X-Auth-Token"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"test\",\n  \"description\": \"develop test\",\n  \"status\": 0,\n  \"userId\": 223437,\n  \"items\": [\n    {\n      \"id\": 75693,\n      \"productId\": 107,\n      \"variantId\": 73,\n      \"quantity\": 0\n    },\n    {\n      \"id\": 85416,\n      \"productId\": 86,\n      \"variantId\": 66,\n      \"quantity\": 40\n    },\n    {\n      \"id\": 76533,\n      \"productId\": 112,\n      \"variantId\": 79,\n      \"quantity\": 1\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java example-1
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api-b2b.bigcommerce.com/api/v3/io/shopping-list/1")
  .header("X-Auth-Token", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"test\",\n  \"description\": \"develop test\",\n  \"status\": 0,\n  \"userId\": 223437,\n  \"items\": [\n    {\n      \"id\": 75693,\n      \"productId\": 107,\n      \"variantId\": 73,\n      \"quantity\": 0\n    },\n    {\n      \"id\": 85416,\n      \"productId\": 86,\n      \"variantId\": 66,\n      \"quantity\": 40\n    },\n    {\n      \"id\": 76533,\n      \"productId\": 112,\n      \"variantId\": 79,\n      \"quantity\": 1\n    }\n  ]\n}")
  .asString();
```

```php example-1
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api-b2b.bigcommerce.com/api/v3/io/shopping-list/1', [
  'body' => '{
  "name": "test",
  "description": "develop test",
  "status": 0,
  "userId": 223437,
  "items": [
    {
      "id": 75693,
      "productId": 107,
      "variantId": 73,
      "quantity": 0
    },
    {
      "id": 85416,
      "productId": 86,
      "variantId": 66,
      "quantity": 40
    },
    {
      "id": 76533,
      "productId": 112,
      "variantId": 79,
      "quantity": 1
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-Auth-Token' => '<apiKey>',
  ],
]);

echo $response->getBody();
```

```csharp example-1
using RestSharp;

var client = new RestClient("https://api-b2b.bigcommerce.com/api/v3/io/shopping-list/1");
var request = new RestRequest(Method.PUT);
request.AddHeader("X-Auth-Token", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"test\",\n  \"description\": \"develop test\",\n  \"status\": 0,\n  \"userId\": 223437,\n  \"items\": [\n    {\n      \"id\": 75693,\n      \"productId\": 107,\n      \"variantId\": 73,\n      \"quantity\": 0\n    },\n    {\n      \"id\": 85416,\n      \"productId\": 86,\n      \"variantId\": 66,\n      \"quantity\": 40\n    },\n    {\n      \"id\": 76533,\n      \"productId\": 112,\n      \"variantId\": 79,\n      \"quantity\": 1\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift example-1
import Foundation

let headers = [
  "X-Auth-Token": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "test",
  "description": "develop test",
  "status": 0,
  "userId": 223437,
  "items": [
    [
      "id": 75693,
      "productId": 107,
      "variantId": 73,
      "quantity": 0
    ],
    [
      "id": 85416,
      "productId": 86,
      "variantId": 66,
      "quantity": 40
    ],
    [
      "id": 76533,
      "productId": 112,
      "variantId": 79,
      "quantity": 1
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api-b2b.bigcommerce.com/api/v3/io/shopping-list/1")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```