Skip to content
This repository has been archived by the owner on Feb 23, 2024. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
…ocks into add/8233-product-image-gallery-block
  • Loading branch information
gigitux committed Jan 30, 2023
2 parents 13dc046 + 07067ec commit c768772
Showing 1 changed file with 39 additions and 5 deletions.
44 changes: 39 additions & 5 deletions src/StoreApi/docs/cart.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@
- [Update Customer](#update-customer)
- [Select Shipping Rate](#select-shipping-rate)

Test:

- Hello
- Hello 2

The cart API returns the current state of the cart for the current session or logged in user.

All POST endpoints require [Nonce Tokens](nonce-tokens.md) and return the updated state of the full cart once complete.
Expand Down Expand Up @@ -339,6 +334,45 @@ Returns the full [Cart Response](#cart-response) on success, or an [Error Respon

If you want to add supplemental cart item data before it is passed into `CartController::add_to_cart` use the [`woocommerce_store_api_add_to_cart_data`](https://github.com/woocommerce/woocommerce-blocks/blob/4d1c295a2bace9a4f6397cfd5469db31083d477a/docs/third-party-developers/extensibility/hooks/filters.md#woocommerce_store_api_add_to_cart_data) filter.

If you want to add multiple items at once, you need to use the batch endpoint:

```http
POST /wc/store/v1/batch
```

The JSON payload for adding multiple items to the cart would look like this:

```json
{
"requests": [
{
"path": "/wc/store/v1/cart/add-item",
"method": "POST",
"cache": "no-store",
"body": {
"id": 26,
"quantity": 1
},
"headers": {
"Nonce": "1db1d13784"
}
},
{
"path": "/wc/store/v1/cart/add-item",
"method": "POST",
"cache": "no-store",
"body": {
"id": 27,
"quantity": 1
},
"headers": {
"Nonce": "1db1d13784"
}
}
]
}
```

## Remove Item

Remove an item from the cart and return the full cart response, or an error.
Expand Down

0 comments on commit c768772

Please sign in to comment.