Webhooks

Cart Updated

Webhook event fired when a storefront cart or one of its items changes

Overview

The Cart Updated event fires each time a customer changes a cart on the storefront, including every change to a cart item. The payload is the whole cart as it is after the change: every item, the price of each item that can be priced, and the cart's totals.

When it triggers

This webhook fires when a customer:

  • Adds an item to the cart.
  • Changes an item, such as its quantity, material, color, infill or precision.
  • Removes an item from the cart.
  • Adds or deletes a comment on an item.
  • Uploads or deletes a file attached to an item.
  • Changes the cart's details, such as its currency, notes, discount, billing address, delivery address or shipping method.
  • Claims an anonymous cart by signing in, so the cart becomes theirs.

Anonymous carts fire it too, with customer set to null. Deleting a cart or turning it into an order doesn't fire it.

The payload doesn't say what changed. To find out, compare it with the last payload you received for the same cartId, matching items by id.

Payload

The decrypted payload is a JSON object with the following fields:

FieldTypeNullableDescription
cartIdstringNoUnique identifier for the cart (a UUID).
cartNumbernumberYesSequential cart number assigned to the cart.
statusstringNoAlways "OPEN": only open carts can change.
customerobjectYesThe customer who owns the cart. null for anonymous carts. See Customer object.
customerOrganisationIdnumberYesID of the customer organisation. null for anonymous carts.
customerOrganisationNamestringYesName of the customer organisation. null for anonymous carts.
itemsarrayNoEvery item in the cart, priced or not. See Item object.
createdAtnumberNoWhen the cart was created, in seconds since the Unix epoch, with a fractional part (e.g., 1793269800.123456000).
currencystringYesCurrency of every price in the payload: your account's payment currency (e.g., "USD"), not the currency the customer picked. null when no item has a part, a process and a material.
subtotalnumberYesSum of the prices of the priced items, before tax. null when no item has a part, a process and a material.
totalnumberYesQuoted total for the priced items. It includes tax, any minimum order top-up and any order-level charges your pricing adds. null when no item has a part, a process and a material.

subtotal and total cover only items with priced: true. They don't include the discount or shipping chosen on the cart, so they can differ from the total the customer sees at checkout.

Customer object

Present when the cart belongs to a signed-in customer. null for anonymous carts.

FieldTypeNullableDescription
idnumberNoUnique identifier for the customer.
emailstringYesCustomer's email address.
firstNamestringYesCustomer's first name.
lastNamestringYesCustomer's last name.
phoneNumberstringYesCustomer's phone number.

Item object

FieldTypeNullableDescription
idnumberNoUnique identifier for the cart item.
namestringYesName the customer gave the item, if any.
quantitynumberNoNumber of units.
technologystringYesManufacturing technology (e.g., "FDM", "SLS").
materialstringYesMaterial used (e.g., "PA12 Nylon").
colorstringYesColor specification, if applicable.
infillstringYesInfill percentage, if applicable.
precisionstringYesPrecision/tolerance level, if applicable.
unitPricenumberYesPrice of one unit, in currency. null when the item isn't priced.
pricenumberYesPrice for the whole quantity, in currency. null when the item isn't priced.
pricedbooleanNotrue when the item has a price. An item has no price until it has a part, a process and a material, and it stays unpriced if your pricing can't quote it (for example, when its process has no price). So currency, subtotal and total can be set while every item has priced: false.

Example payload

{
  "cartId": "3f2b8c1e-5d4a-4e7b-9c1f-2a6d8e0b7c41",
  "cartNumber": 42,
  "status": "OPEN",
  "customer": {
    "id": 99,
    "email": "alex@acme.com",
    "firstName": "Alex",
    "lastName": "Johnson",
    "phoneNumber": "+1-555-0199"
  },
  "customerOrganisationId": 678,
  "customerOrganisationName": "Acme Manufacturing",
  "items": [
    {
      "id": 5101,
      "name": "Bracket",
      "quantity": 10,
      "technology": "SLS",
      "material": "PA12 Nylon",
      "color": "Black",
      "infill": null,
      "precision": null,
      "unitPrice": 12.50,
      "price": 125.00,
      "priced": true
    },
    {
      "id": 5102,
      "name": "Housing",
      "quantity": 2,
      "technology": null,
      "material": null,
      "color": null,
      "infill": null,
      "precision": null,
      "unitPrice": null,
      "price": null,
      "priced": false
    }
  ],
  "createdAt": 1793269800.123456000,
  "currency": "USD",
  "subtotal": 125.00,
  "total": 135.00
}

Last updated on

On this page