> Portal Navigation:
> 
> - Append `.md` to any URL under `https://dev.wix.com/docs/` to get its markdown version.
> - Pages are either content pages (article or reference text) or menu pages (a list of links to child pages).
> - To get a menu page, truncate any URL to a parent path and append `.md` (e.g. `https://dev.wix.com/docs/sdk.md`, `https://dev.wix.com/docs/sdk/core-modules.md`).
> - Top-level index of all portals: https://dev.wix.com/docs/llms.txt
> - Full concatenated docs: https://dev.wix.com/docs/llms-full.txt

## Resource: Add a Service Plugin Extension in Studio Two

## Article: Add a Service Plugin Extension in Studio Two

## Article Link: https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-backend/service-plugins/add-a-service-plugin-extension-in-studio-two.md

## Article Content:

# Add a Service Plugin Extension in Studio Two

A [service plugin](https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-backend/service-plugins/about-service-plugins.md) is custom backend logic that Wix calls during one of its own flows, such as checkout or booking.

Follow the instructions below to:

1. Add a service plugin extension to your site project.
2. Customize the plugin.
3. Check the plugin.
4. Publish your site with the plugin.

> **Note:** You can also ask **Aria**, Wix's AI assistant, to create and customize the extension.

## Step 1 | Add a service plugin

To add a service plugin:

1. In the Studio Two editor, open the **Code** tab.
2. In the VS Code sidebar, open the **Wix Extension Builder**.

   ![the Wix Extension Builder in the VS Code activity bar](https://wixmp-833713b177cebf373f611808.wixmp.com/images/6bff2816a5bfe47ed855a1859cd89d5a.png)

3. Under **Create an Extension**, choose **Backend**, then **Service Plugin**.
4. Fill in the form:
   - **Which service plugin do you want to create**: The Wix service this plugin extends. The list is fixed. For example, choose **Ecom Additional Fees**. For every type the Builder offers, see [Available Service Plugins](https://dev.wix.com/docs/backend-extensions/service-plugins/available-service-plugins.md).
   - **Name**: The folder and file name. The name can be at most 19 characters. Choosing a plugin fills this in with a slug of that plugin, shortened to 19 characters when the slug is longer. For example, **Ecom Additional Fees** fills `ecom-additional-fee`.
5. Click **Generate**.

You can find the new files under `src/extensions/backend/service-plugins/<plugin-name>/`. The extension is registered in your project's `extensions.ts` and listed under **My Extensions**. For what each file is for, see [Service Plugin Extension Files and Code](https://dev.wix.com/docs/backend-extensions/service-plugins/service-plugin-extension-files-and-code.md).

## Step 2 | Customize your service plugin

You can edit the generated files to match the service behavior you need. Change the code yourself, or ask the AI in the **Code** tab to help. When you're happy with the plugin, move on to the next step.

For the handler, the configuration file, and the response your plugin type must return, see [Build a Service Plugin in Studio Two](https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-backend/service-plugins/build-a-service-plugin-in-studio-two.md).

For example, for an Ecom Additional Fees plugin:

1. Open `<plugin-name>.ts`.
2. Return the fees you want instead of an empty `additionalFees` array.
3. Save the file.

When the checkout flow requests additional fees, your plugin returns those values.

## Step 3 | Check the plugin

To check a service plugin, trigger the Wix flow that uses it. The trigger differs per plugin type. For example, for an Ecom Additional Fees plugin:

1. Install a Wix app that uses Wix eCommerce, such as Wix Stores, and add at least 1 product.
2. Go through checkout on your live or preview site to trigger the plugin.
3. To confirm the handler ran, even if the change doesn't visibly appear in the checkout UI, write a temporary log entry in your handler with the monitoring client, then check the **Logs** page in the site dashboard under **Developer Tools**. `console` output doesn't appear there. See [Write Log Messages in Studio Two](https://dev.wix.com/docs/studio-two/test-your-site/work-with-logs/write-log-messages.md).

> **Note:** Calling the underlying eCommerce APIs directly doesn't reach the plugin. The handler only runs as part of an actual checkout flow on the site itself.

## Step 4 | Publish your site

When you're ready, click **Publish** in the Studio Two editor to ship the extension with your site.

## See also

- [About Service Plugins](https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-backend/service-plugins/about-service-plugins.md)
- [Build a Service Plugin in Studio Two](https://dev.wix.com/docs/studio-two/code-your-site/build-a-custom-backend/service-plugins/build-a-service-plugin-in-studio-two.md)
- [Service Plugin Extension Files and Code](https://dev.wix.com/docs/backend-extensions/service-plugins/service-plugin-extension-files-and-code.md)
- [Available Service Plugins](https://dev.wix.com/docs/backend-extensions/service-plugins/available-service-plugins.md)
- [About Studio Two Extensions](https://dev.wix.com/docs/studio-two/get-started/about-studio-two-extensions.md)
- [Service Plugins](https://dev.wix.com/docs/overview/extensions-framework/backend-extensions/service-plugins.md)