# Generate Cart Item

As an alternative, or supplemental, to the traditional [Add to Cart](/integration/ecommerce/add-to-cart.md) and [Save Design](/integration/ecommerce/save-design.md) methods, Spectrum can generate the payload data for a cart item.&#x20;

An e-commerce system can call the following method, provided by Spectrum on the window object:

```javascript
window.spectrumGenerateCartItem() // returns a promise
```

Which will trigger Spectrum to return the payload data via a native promise.&#x20;

```javascript
  // payload.recipeSetId: string
  // payload.items: array | null
  // payload.items[n]: object
  // payload.items[n].sku: string | null
  // payload.items[n].name: string | null
  // payload.items[n].quantity: number | null
  // payload.primaryThumbnailAngle: string | null
  // payload.thumbnailsByAngle: array | null
  // payload.thumbnailsByAngle[n].angleName: string
  // payload.thumbnailsByAngle[n].url: string
  // payload.options: object | null
  // payload.options[optionName]: string
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.spectrumcustomizer.com/integration/ecommerce/generate-cart-item.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
