Extension Config


To configure and customize your service plugin, you need to provide important details in the plugin.json configuration file.

Note

If you created your service plugin extension with the CLI, required fields are automatically populated for you.

Configuration Params
deploymentUristring

Base URI where the endpoints are called. Wix eCommerce appends the endpoint path to the base URI. For example, to call the Calculate Additional Fees endpoint at https://my-additional-fees.com/v1/calculateAdditionalFees, the base URI you provide here is https://my-additional-fees.com/.

Additional Fees Extension Config
JSON
{ "deploymentUri": "https://my-additional-fees-app.com/" }
Did this help?

calculateAdditionalFees( )


Important: This is a handler function. Implement it only as part of the service plugin.


This method retrieves additional fees calculated by your app.

Wix calls this method when certain actions are performed on the cart or checkout. For example, when an item is added to the cart or the amount of an item is updated in the checkout.

Notes:

  • Do not call the Estimate Cart Totals, Estimate Current Cart Totals or Get Checkout methods from your implementation code for Calculate Additional Fees. Doing so will result in an error.
  • The currency returned in the response object must match the site's currency or those fees will be filtered out and not returned.
Method Declaration
Copy
function calculateAdditionalFees(
  payload: CalculateAdditionalFeesEnvelope,
): CalculateAdditionalFeesResponse | Promise<CalculateAdditionalFeesResponse>;
Method Parameters
payloadCalculateAdditionalFeesEnvelope
Returns
Return Type:CalculateAdditionalFeesResponse | Promise<CalculateAdditionalFeesResponse>
Example of an `additionalFees` return value
JavaScript
import { additionalFees } from "@wix/ecom/service-plugins"; additionalFees.provideHandlers({ calculateAdditionalFees: async (payload) => { const { request, metadata } = payload; // Use the `request` and `metadata` received from Wix and // apply custom logic. return { // Return your response exactly as documented to integrate with Wix. // Return value example: additionalFees: [ { code: "subscription-fee", name: "Subscription Fee", price: "5", taxDetails: { taxable: true, }, }, ], currency: "USD", }; }, });
Did this help?