Within your project, the source code for service plugins is found in the src/extensions/
folder. Each service plugin is defined in its own subfolder that contains two files:
extension.json
: Provides all required configuration for your plugin.plugin.ts
: Contains functions that override the functions called by Wix for the plugin.This file is required and provides all the necessary configuration for your plugin.
The file contains an object with each of the required fields you can use to customize your plugin. You will need to add any optional configuration fields yourself.
You can find the details for each of these fields by locating your service plugin in this table and clicking on the link to view its documentation.
Note: Your plugin.json
file doesn't require a deployment URI as the CLI knows where to call your app's endpoint.
Field | Type | Description |
---|---|---|
compId | string | Service plugin ID, auto-generated by Wix. Must be unique across all extensions in the project. |
compType | string | Always SERVICE_PLUGIN for service plugins. |
compName | string | The service plugin name. |
compData.servicePlugin.hostingPlatform | string | Always HEADLESS . |
compData.servicePlugin.serviceType | string | The type of service plugin (e.g., shippingRates ). |
compData.servicePlugin.config | object | Plugin-specific configuration fields. |
This file is required and contains handler functions that Wix calls automatically when the relevant site action triggers them.
The file contains:
For example, the plugin.ts
for the shipping rates plugin looks like this:
Your custom logic should be placed inside the {}
for each of these functions. To find out what your function receives in the parameters and what it must return, see the documentation. Locate your service plugin in this table and click on the link to view its documentation, then navigate to the specific function in the menu.