Vendure · Example Payload

Vendure Shop Add Item Example

Example: add a product variant to the active order.

CommerceHeadless CommerceeCommerceGraphQLOpen SourceTypeScriptNestJSB2BB2CStorefrontPlugins

Vendure Shop Add Item Example is an example object payload from Vendure, with 3 top-level fields. It illustrates the shape of data this provider's APIs accept or return.

Top-level fields

descriptionrequestresponse

Example Payload

Raw ↑
{
  "description": "Example: add a product variant to the active order.",
  "request": {
    "method": "POST",
    "url": "http://localhost:3000/shop-api",
    "headers": {
      "Content-Type": "application/json",
      "vendure-token": "default-channel-token"
    },
    "body": {
      "query": "mutation AddItem($variantId: ID!, $quantity: Int!) { addItemToOrder(productVariantId: $variantId, quantity: $quantity) { ... on Order { id code totalQuantity totalWithTax } ... on ErrorResult { errorCode message } } }",
      "variables": { "variantId": "42", "quantity": 1 }
    }
  },
  "response": {
    "status": 200,
    "body": {
      "data": {
        "addItemToOrder": {
          "id": "1",
          "code": "1XJTYJB99CSHV9JE",
          "totalQuantity": 1,
          "totalWithTax": 2499
        }
      }
    }
  }
}