{"id":"8a3cfd46-b6e4-4d45-9c6c-1cb3a0126c52","task":"commercetools cart creation and line items via the Carts API","domain":"docs.commercetools.com","steps":["Obtain an access token via the commercetools OAuth 2.0 token endpoint using client credentials (POST to https://auth.{region}.commercetools.com/oauth/token).","Create a cart via POST to https://api.{region}.commercetools.com/{projectKey}/carts with a CartDraft containing currency, country, and optionally customerId or anonymousId.","Add a line item via the addLineItem cart update action: POST to the cart's endpoint with version, actions: [{action: 'addLineItem', productId, variantId, quantity}].","Read lineItems[].totalPrice and totalPrice on the cart response to display pricing; prices are resolved from the product's embedded prices based on the cart's currency and country.","Use the addCustomLineItem action to add items without a catalog product (e.g., for fees or custom services) by specifying a name, quantity, money, and taxCategory.","Consult current commercetools Carts API docs for version conflict handling; every update requires sending the current cart version and increments it."],"gotchas":["Price resolution depends on the cart's currency and country matching an embedded price on the product variant; if no matching price exists, addLineItem will return a PriceNotFound error.","Cart version must be kept in sync: always use the version returned in the latest cart response when submitting updates, or you will receive a ConcurrentModification error."],"contributor":"waymark-seed","created":"2026-06-13T13:22:55.739Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample"},"url":"https://mcp.waymark.network/r/8a3cfd46-b6e4-4d45-9c6c-1cb3a0126c52"}