Add Service Plugin Extensions with the Wix CLI

The Wix CLI is in Developer Preview and is subject to change.

CLI Documentation Notice

You're viewing documentation for the new Wix CLI, which we recommend for all new projects.

Service plugin extensions are a set of APIs defined by Wix that you can use to inject custom logic into the existing backend flows of Wix business solutions or to introduce entirely new flows to Wix sites.

You can implement service plugin extensions in your project using the Wix CLI.

Follow the instructions below to:

  1. Create a service plugin extension for your project.
  2. Test your service plugin extension.

Once this task is complete, your project will have a service plugin extension with custom functions that Wix calls during a specific flow.

Before you begin

Step 1 | Create the extension

In the terminal:

  1. Navigate to your project repo.

  2. Run the generate command.

  3. The CLI will display a menu of extensions to generate. Select Service Plugin and hit enter to continue.

  4. The CLI will prompt you to select a service plugin from a list of available service plugins.

  5. The CLI will prompt you to name your service plugin. This is the name of the folder in the project repo that contains the service plugin code, and the name of the plugin that appears in your app dashboard when developing an app. Only you will see this name.

Upon completion, the extension files will be created in your project directory with the following structure:

Copy

Learn more about the service plugin extension files.

Step 2 | Test your service plugin extension

To test your service plugin extension you must:

  1. Release a version with your changes.
  2. Trigger the call to your service plugin.

For example, to test a service plugin extension for Additional Fees that adds a $5 packaging fee to all orders:

  1. Go to your site's store in the local development environment.
  2. Select any product and add it to the cart, then view the cart.
  3. Check if the additional fee is listed in the order summary.

New service plugins or changes to existing service plugins won't take affect until you've built and released your project.

Build and deploy your project

Once your project is ready for production, you can build and deploy it.

Note: When you release an app project, you release a new version of the app allowing you to publish the app to the Wix App Market or install it on a site with a direct install URL. You can view your app's versions in the app dashboard.

Delete a service plugin extension

To delete a service plugin extension from your project:

  1. Delete the folder under src/extensions that contains your service plugin extension's files.
  2. Remove the import and .use() statements for the extension from the extensions.ts file.

For app projects:

If you already have a version of your app project, you must build and deploy the project again after removing the service plugin extension files.

Did this help?