> For the complete documentation index, see [llms.txt](https://docs.okendo.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.okendo.io/on-site/advanced-widget-installs/installing-quizzes-with-custom-carts.md).

# Installing Quizzes with Custom Carts

Okendo Quizzes integrates with basic Shopify themes by refreshing the cart counter and updating the cart drawer if available.

If your store uses a theme that is not fully supported, or uses additional cart plugins or custom cart integrations, you may need to perform some additional steps to make sure that the Quiz (particularly the results page, where there are cart interactions) is fully functional for your online store.

## Variant added event

Add an event listener in your theme code to react to whenever an item has been added to the cart from the Quiz results page:

```typescript
document.addEventListener('oke_connect_cart_itemVariantAdded', async event => {
    console.log(event.detail);
});
```

## “Add To Cart” doesn’t update the shopping cart icon

Use the `oke_connect_cart_itemVariantAdded` event to trigger your custom cart to update. The following is an example only. Your custom cart API may be different:

```typescript
document.addEventListener('oke_connect_cart_itemVariantAdded', async event => {
		// Example only. Check your custom cart API.
		const { detail } = event;
		const customEvent = new CustomEvent('theme:cart:update', { detail: { id, quantity } });
    document.dispatchEvent(customEvent);
});
```

## “Add To Cart” doesn’t open the cart drawer

Use the `oke_connect_cart_itemVariantAdded` event to trigger the cart drawer for your custom cart. Some custom carts may open the cart drawer for you at the same time as the cart items are updated:

```typescript
document.addEventListener('oke_connect_cart_itemVariantAdded', async event => {
		// Example only. Check your custom cart API.
		window.cart.openCartDrawer();
});
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://docs.okendo.io/on-site/advanced-widget-installs/installing-quizzes-with-custom-carts.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
