Note: Currently, self-hosted site plugins are not supported on the checkout page. If you want to build a plugin for the checkout page, you can build it with Wix Blocks.
A site plugin is a type of component that site builders can place in designated locations (called slots) within Wix apps. Site plugins extend the functionality of their host app by providing additional UI elements and business logic.
You can create a site plugin extension using custom element technology, with your code deployed on your own server. The custom element is essentially a new HTML tag that you define, which is made available in the Wix editor as a plugin.
To create this extension, do the following:
You can create a new app for your site plugin or add it to an existing app.
Code your custom element and its functionality in a JavaScript file. Use a class to define the element.
Note: For further guidance and examples on using web components, which are the foundation of custom elements, see the MDN documentation.
In your code, create a class for the custom element and register the custom element.
Here is a sample code snippet:
customElements.define()
. You will need it when defining the tag name while configuring the widget extension in your app's dashboard. In our example, the name is my-custom-element
.Custom elements react to DOM-related events. When you create your custom element, use MDN lifecycle callback functions such as connectedCallback()
and attributeChangedCallback()
.
When your code is ready, deploy your custom element’s JavaScript file on a remote or local server.
To enable plugins to communicate with their hosts, each slot supports an API that provides data about the plugin's context (for example, a plugin for the product page can access the productId
property, which the host widget sets to indicate the item that it’s currently displaying).
Learn more about the plugin APIs supported on each app page.
When building a plugin using a custom element, the properties provided in the plugin API are added to the custom elements as attributes. You can get their values in your code using the attributeChangedCallback()
function, for example:
Important:
productId
becomes product-id
.JSON.parse()
to convert them back to their original form.Plugins can use Wix APIs to interact with Wix’s business solutions, such as eCommerce, Stores, and Bookings. Learn more about integrating with Wix APIs
Your plugin should have a settings panel in the editor, which is displayed when a user clicks the Settings button in the plugin's action bar. The panel is rendered as an iframe, which you can build using any tools you like. When it comes to designing the UI, consider using the Wix Design System. It is a collection of reusable React components that you can use to make your panel appear and feel like a native Wix panel.
In the panel’s code, use Wix's JavaScript SDK to access widget properties and retrieve environmental data from the editor, as well as access and manage Wix business solutions.
To apply changes made in the settings panel to the plugin, use the Widget API’s setProp()
function. The properties are bound to your custom element’s attributes, so any change in the properties automatically updates the corresponding attribute. To handle attribute updates so they are reflected in your plugin in the editor, use the attributeChangedCallback()
in your custom element's code.
Here is a sample code snippet showing how to update a custom element’s attribute:
When your code is ready, deploy your settings panel’s HTML file on a remote or local server.
If your plugin requires a back office management interface, you can create one either within the Wix dashboard, or as an external dashboard on a third-party platform. Learn how to build a dashboard page to manage your site plugin
To make your plugin available for installation on sites, set up the plugin in your app dashboard and configure its installation settings and market listing. Your plugin's market listing determines how it will appear to users in the plugin explorer in the editors, including the plugin's name, icon, and teaser.
Note: The plugin's market listing is different from the app's market listing, which determines how the entire app appears in the Wix App Market.
customElements.define()
function in your JavaScript file.Your unpublished plugins are available for installation in the editors when you're logged in with your developer account. This makes it easy to preview and test your plugin in a real environment.
To test your plugin in the editor:
Once you install your plugin on a site, you can preview or publish the site to test the plugin's functionality and make sure it's working properly.
When you’ve finished building and testing your plugin, you’re ready to launch and monetize your app.
Learn more about submitting your app for review.