API reference · Custom Cart

Edit Custom Cart

PUThttps://api.sandbox.cws.digital/customCart/edit

Description

Applies new items to an existing cart, without generating another link: the cartId and the URL stay the same.

The items follow the same identification forms and the same sellerDocument as Create Custom Cart. The store is the cart's own store.

Request body

Content-Typeapplication/jsonRequired
Edit the body with
FieldTypeRequiredDescriptionValue
cartIdintegerYes

Cart id, as it came in cartId on creation.

updateTypestringYes

complement adds the quantities to the items already in the cart; replacement discards the old items and keeps only the ones sent. Always in lowercase. Without it, or with another value, the edit is rejected with 400.

Allowed values:complementreplacement
documentstringYes

CPF or CNPJ of the cart customer, with or without punctuation.

productsarray of objectYes

Items to apply. Up to 100 items.

Fields in products[]

sellerDocumentstringNo

CPF or CNPJ of the seller who owns the stock of the items, as in the creation.

cartNamestringNo

Cart name, for you to identify it later.

sellerEmailstringNo

E-mail of the seller responsible for the cart.

cartTypeNamestringNo

Cart type name.

cartTypeExternalIdstringNo

External id of the cart type, in your system.

metadataarray of objectNo

Free data pairs for you to attach to the cart.

Fields in metadata[]

Items of products[]
products[]
FieldTypeRequiredDescriptionValue
quantityintegerYes

Product quantity. Greater than zero.

warehouseIdintegerConditional

Id of the item's warehouse, from the seller who owns the stock. Goes together with any identification form.

brandstringConditional

Manufacturer brand. Goes together with mfrPartCode, composition and warehouseId.

mfrPartCodestringConditional

Product code at the manufacturer. Goes together with brand, composition and warehouseId.

compositionstringConditional

Product composition (e.g. UNITARY). Goes together with brand, mfrPartCode and warehouseId.

skuAttributeNamestringConditional

Name of the product attribute. Goes together with skuAttributeValue and warehouseId.

skuAttributeValuestringConditional

Value of the product attribute. Goes together with skuAttributeName and warehouseId.

partnerPartCodestringConditional

Your product code in the warehouse. Goes together with warehouseId.

keystringNo

Your own key for the item. It identifies the item in the complement sum and in the deletion by customKey.

storeExternalIdstringNo

Id of the item in your system, saved in the cart item.

Items of metadata[]
metadata[]
FieldTypeRequiredDescriptionValue
keystringNo

Data name.

valuestringNo

Data value.

typestringNo

Data type.

Business rules

The two values of updateType

complement looks up the item by the same product and the same key and adds the quantity sent to the one already there; the new metadata is merged with the old one.

replacement deletes the items that were in the cart and stores only the ones you sent; the metadata is also replaced.

The values are compared exactly, in lowercase.

Carts that can be edited

Only a cart that has not become an order nor been canceled or deleted. The cart must belong to your store, or to a store you are linked to.

Responses

  • 401

    Missing, malformed or expired token.

Try it

Sandbox

Language

Credentials

Access token: saved in this tab and used on every endpoint.

Each token only reaches the partner's own data and that of the branches with an authorized link.

Don't have sandbox credentials yet? See how to request them

Request

cURL
curl --request PUT \
  --url 'https://api.sandbox.cws.digital/customCart/edit' \
  --header 'Authorization: Bearer <access_token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "cartId": 4470001,
  "updateType": "complement",
  "document": "466.935.373-08",
  "products": [
    {
      "brand": "Bosch",
      "mfrPartCode": "TESTE-API-001",
      "composition": "UNITARY",
      "warehouseId": 1001,
      "quantity": 5
    }
  ]
}'

Response

Click Try it to see the real response here, or pick a documented example: