The Catalog service plugin lets you become a Wix catalog provider. This means you can integrate any external repository of sellable items with the Wix eCommerce platform. Wix calls the Catalog service plugin to get up-to-date information about items whenever a cart or checkout is updated, and when an item is added to an order.
With the Catalog service plugin, you can:
The Catalog service plugin enables you to maintain a complex and dynamic external catalog while being confident Wix can retrieve the latest information for every action.
For example, after a customer adds a particular item to their cart, one of the following details might change in your dynamic catalog:
With the Catalog service plugin, you can be sure that when the customer moves the item from their cart to their checkout, Wix will retrieve the updated details from your catalog automatically.
It's important to note the following points before starting to code:
Follow these steps to begin implementing your service plugin.
You can implement this service plugin with the following frameworks:
To configure and customize your plugin, you need to provide important information in the service plugin configuration file. You can configure your plugin in the Wix App Dashboard. For details, see Catalog Extension Configuration.
Use catalog.provideHandlers()
to define the following handler function that implement your custom business logic.
Function | Required |
---|---|
getCatalogItems() | Yes |
Below is an example for implementing the Catalog service plugin in your code.
This is the basic code structure for implementing the Catalog service plugin with the Wix CLI:
This is the basic code structure for implementing a self-hosted Catalog service plugin:
This article explains how to handle item customization and variants when implementing the Catalog service plugin.
catalogReference
objectWhen Wix calls the Get Catalog Items method, it includes a catalogReference
object containing the reference details for each item to retrieve from your catalog. This object includes the following properties:
catalogItemId
: The ID of the item in the catalog it belongs to. You can use any system you like for generating and storing unique item IDs. You may wish to expose an API so your app can query and retrieve item IDs.appId
: ID of the app providing the catalog. You can get your app's ID from your app's dashboard.options
: Additional item details in key:value pairs. Use this optional field to specify a variant of the item or add custom details. See below for more information.options
fieldIn some cases, your catalog might need more than just the item ID and app ID in order to return all of the correct item details. On a site's item page, visitors can often choose variants of the item or add custom details. For example:
There are several ways you can use the options
object for handling item variants. Here are two different approaches to implementing it. Decide which approach to take based on your technical requirements, existing system architecture, and business needs.
options
You can pass specific information about the item in the options
object as key:value pairs. You can choose how to structure the information and what keys and values to support.
For example, you can specify item variant details in any of the following ways:
"options": {"Size": "M", "Color": "Red"}
"options": {"customText": "Natalie"}
"options": {"recipientName": "Omar", "message": "Happy anniversary!"}
If you take this approach, make sure that:
options
properties, processes them, and returns the correct item details.options
property of the item's catalogReference
only includes key:value pairs that your catalog supports.Use this approach if:
options
object's properties in your implementation of Get Catalog Items.options
You can create a separate API that processes item variants and returns a unique variant ID. Then your app can pass an options
object containing only the item variant ID. When Wix calls Get Catalog Items, your Catalog service plugin retrieves the correct details for the item variant on the basis of this ID and returns them.
For example, suppose you are creating an app for processing donations that can be added to a customer's transaction. You could implement this as follows:
organizationId
, campaignId
and amount
. It returns a unique donationId
.donationId
.donationId
.catalogReference
object's options
property. For example: "options": { "donationId": "bf3b953d-d0b7-4755-a54e-13c167fc4484"}
.catalogReference
for the item, including the unique donationId
. On the basis of this ID, the method returns the full details for the specific donation, which can then be added to the cart, checkout, or order.If you take this approach, make sure that:
options
property of the item's catalogReference
contains a field with the item variant ID your API generated.options
object, and returns the correct item details.Use this approach if: