> For the complete documentation index, see [llms.txt](https://docs.firework.com/firework-for-developers/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.firework.com/firework-for-developers/web/integration-guide/shopping-integration-v2/migrate-from-v1.md).

# Migrate from V1

If you have already integrated with our legacy event-based shopping integration, this page will help you migrate to the latest APIs.

## Access Shopping API

Shopping APIs v2 is only available after Firework SDK is loaded. It's important to listen to `fw-ready` event, as well as checking whether the script is loaded already.

```javascript
<script async src="//asset.fwcdn3.com/js/fwn.js" type="text/javascript" ></script>
<script>
  if (window._fwn?.shopping) {
    // if window._fwn?.shopping is loaded before this script tag, use it directly
  } else {
    document.addEventListener('fw-ready', () => {
      // window._fwn.shopping is available within the callback
    })
  }
</script>
```

## Configure Cart

You no longer need to manually create the `_fwnStoreFront` object, which is now deprecated. To enable the cart sync feature, you must call `_fwn.shopping.configureCart` method.

```javascript
window._fwn.shopping.configureCart({
  url: 'https://firework.com/cart',
  currency: 'USD'
})
```

## Product Hydration

Use `_fwn.shopping.onProductsLoaded` to set up an async callback. Stop listening to `fw:shopping:hydrate-products` event. Check [Product Hydration](/firework-for-developers/web/integration-guide/shopping-integration-v2/product-hydration.md) page for more details.

## Cart Sync

To sync the website cart items with the player, use `_fwn.shopping.onCartDisplayed` to set up an async callback. Stop listening to `fw:shopping:hydrate-cart` event.

To sync the player cart updates with the website cart, use `_fwn.shopping.onCartUpdated` to set up an async callback. Stop listening to `fw:shopping:cart-updated` event.

Check [Cart Sync](/firework-for-developers/web/integration-guide/shopping-integration-v2/cart-sync.md) page for more details.

## Product Factory

`validateRequiredFields` is added to `productFactory` as a second param. It can be used to verify whether you miss any required fields while creating a new FW product. You can turn it on to double check your existing factory method.


---

# 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.firework.com/firework-for-developers/web/integration-guide/shopping-integration-v2/migrate-from-v1.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.
