Build a Service Plugin in Studio Two

A service plugin is a configuration file plus a handler. You generate the files first, then spend most of your time in the handler.

This article walks through that loop for an Ecom Additional Fees plugin. Other plugin types use the same two files. The handler's functions and return value depend on the type you chose.

Follow the instructions below to:

  1. Scaffold the plugin.
  2. Keep the configuration.
  3. Write the handler.

Step 1 | Scaffold the plugin

Start from a generated service plugin rather than an empty folder, so the file structure and registration are already in place.

For the full procedure, see Add a Service Plugin Extension in Studio Two.

You can find the new files under src/extensions/backend/service-plugins/<plugin-name>/. You spend most of this article in <plugin-name>.ts. For what every file in the folder is for, see Service Plugin Extension Files and Code.

Step 2 | Keep the configuration

<plugin-name>.extension.ts is the configuration file. For an Ecom Additional Fees plugin it looks like this:

Copy

Keep id stable. name matches the folder name. source is the path to the handler, relative to src/.

The builder function changes with the plugin type. Generate picks the function that matches the type you chose. For every field, see Service Plugin Extension Files and Code.

Step 3 | Write the handler

<plugin-name>.ts is the code Wix calls. A generated Ecom Additional Fees handler returns no fees:

Copy

request is the cart and checkout state Wix sends. metadata includes the call context. Your return value has to match the method's contract or Wix ignores the response.

For example, to return a fee:

  1. Open <plugin-name>.ts.
  2. Replace the empty additionalFees array with the fees you want to add.
  3. Save the file.

With one fee in the array, the handler looks like this:

Copy

currency has to match the site's currency. The fields each fee needs, including the name and amount, are on Calculate Additional Fees.

For any other plugin type, open that plugin in Available Service Plugins and use its API reference for the handler functions and the response.

To check the plugin, trigger the Wix flow that calls it. For additional fees, that is a checkout on a site with an eCommerce app installed. See Add a Service Plugin Extension in Studio Two.

When the plugin behaves the way you want, click Publish in the Studio Two editor to ship it with your site.

See also

Last updated: 2 November 2026

Did this help?