POST
/
v1
/
carts
/
:id
/
products
Adicionando produtos
curl --request POST \
  --url https://lojinha.dev/api/v1/carts/:id/products \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "id": "<string>",
  "quantity": 123
}'
{
  "cart": {
    "id": "4f24a75c-792a-4aff-9265-19deb198be07",
    "store": "org_2StqHEqEqKtCH66IJjLb73J2ww6",
    "customerId": null,
    "addressId": null,
    "price": 16000,
    "originalPrice": null,
    "status": "PENDING",
    "createdAt": "2023-07-23T22:04:52.234Z",
    "updatedAt": null,
    "deletedAt": null,
    "products": [
      {
        "id": "4cf35a0f-7f25-43ef-8e5e-208fbfeb1bd0",
        "store": "org_2StqHEqEqKtCH66IJjLb73J2ww6",
        "status": "ACTIVE",
        "name": "A Tormenta de Espadas",
        "slug": "a-tormenta-de-espadas",
        "description": "<p>Terceiro livro da série</p>",
        "price": 8000,
        "originalPrice": 12000,
        "quantity": 10,
        "sku": "LI-004",
        "createdAt": "2023-07-22T00:51:44.685Z",
        "updatedAt": "2023-07-23T22:04:32.178Z",
        "deletedAt": null,
        "order": {
          "quantity": 2,
          "price": 16000
        }
      }
    ]
  }
}
Se o produto já existe no carrinho, a quantidade dele no carrinho é incrementada.

URL

id
uuid
required
Id do carrinho que você deseja recuperar.

Body

id
uuid
required
ID do produto.
quantity
number
required
Quantidade do produto para adicionar no carrinho.

Resposta

cart
object
{
  "cart": {
    "id": "4f24a75c-792a-4aff-9265-19deb198be07",
    "store": "org_2StqHEqEqKtCH66IJjLb73J2ww6",
    "customerId": null,
    "addressId": null,
    "price": 16000,
    "originalPrice": null,
    "status": "PENDING",
    "createdAt": "2023-07-23T22:04:52.234Z",
    "updatedAt": null,
    "deletedAt": null,
    "products": [
      {
        "id": "4cf35a0f-7f25-43ef-8e5e-208fbfeb1bd0",
        "store": "org_2StqHEqEqKtCH66IJjLb73J2ww6",
        "status": "ACTIVE",
        "name": "A Tormenta de Espadas",
        "slug": "a-tormenta-de-espadas",
        "description": "<p>Terceiro livro da série</p>",
        "price": 8000,
        "originalPrice": 12000,
        "quantity": 10,
        "sku": "LI-004",
        "createdAt": "2023-07-22T00:51:44.685Z",
        "updatedAt": "2023-07-23T22:04:32.178Z",
        "deletedAt": null,
        "order": {
          "quantity": 2,
          "price": 16000
        }
      }
    ]
  }
}