This article presents sample flows your app can support. You aren't limited to this exact flow, but it can be a helpful jumping off point as you plan your catalog integration.
Note: In this example, item variant details are passed in the request. Learn more about this approach to handling item variants.
In this flow, a site visitor adds an item to their cart. Wix calls the Catalog service plugin to retrieve the item's full details. Before implementing this flow, configure your app, so it can communicate with your Catalog service plugin implementation.
A site visitor selects a color and size for a customizable T-shirt on a Wix site's item page. Then they add it to their cart.
The app code calls Add To Current Cart with the following lineItems
array in the payload to create a new cart that includes the item:
The catalogReference
object for the item includes:
appId
: The ID of the app the catalog belongs to. This tells Wix which app's implementation of the Catalog service plugin to call.catalogItemId
: The ID of the item in the catalog it belongs to.options
: Item variant information.In this case, the app handles item variants by passing the variant details in the catalogReference
object's options
field.
Wix automatically calls your app's implementation of Get Catalog Items with the following payload as an encoded JWT to retrieve the item's full and current details:
Your implementation of Get Catalog Items returns a response like this one:
It's important to note the following about the response:
catalogReference
object in the response must be identical to the one received in the request.options
.Wix adds the item to the visitor's cart, including the name, price, image, and variant details.
Note: In this example, item variant details are processed externally via a custom API that returns a unique ID. Learn more about this approach to handling item variants.
In this flow, a site visitor adds an item to their checkout. Wix calls the Catalog service plugin to retrieve the item's full details. Before implementing this flow, configure your app, so it can communicate with your Catalog service plugin implementation.
A site visitor selects a color and size for a customizable T-shirt on a Wix site's item page. Then they click Buy Now to add it directly to their checkout.
The app code calls a custom API with the variant details. The custom API validates and stores these details, then returns a unique variantId
.
The app code calls Create Checkout with the following lineItems
array in the payload to create a new checkout that includes the item:
The catalogReference
object for the item includes:
appId
: The ID of the app the catalog belongs to. This tells Wix which app's implementation of the Catalog SPI to call.catalogItemId
: The ID of the item in the catalog it belongs to.options
: Item variant information.In this case, the app handles item variants by using a custom API to generate and store the variant details. It then passes only the variant ID details in the catalogReference
object's options
field.
Wix automatically calls your app's implementation of Get Catalog Items with the following payload as an encoded JWT to retrieve the item's full and current details:
Your implementation of Get Catalog Items returns a response like this one:
It's important to note the following about the response:
catalogReference
object in the response must be identical to the one received in the request.variantID
provided in options
.Wix adds the item to the visitor's checkout, including the name, price, image, and variant details.