header-logo
Getting started with WixBuild your website and business with Wix. Try using our AI tools to create your website, customize templates, or hire professionals to build or enhance your online presence.
Creating a websiteRead how to use the Wix Editor and manage content on your site. Discover how to protect your visitors' privacy and make your site accessible.
Account & billingReview your account settings, manage your subscriptions and plans and understand your invoices.
Using the Wix mobile appsUse our mobile apps to run your business efficiently on the go and set up a dedicated app for your site members to stay in touch.
Connecting a domainFollow our step-by step guides to learn how to purchase, connect or transfer a domain for your site, and find out how to keep your site’s data secure.
Managing your businessGet tools to grow your business and web presence. Find the right tools for your specific needs, set up online payments and keep track of your site's analytics.
Promoting your siteLearn to make your site more visible promoting it on search engines, sending emails and running paid ads. Improve your online presence with practical tips.
Studio, Partners & EnterpriseGet the most out of your Studio or Enterprise account with advanced features that'll help you work more efficiently.
Need more help?Find solutions for site performance and technical issues, learn about issues we’re working to fix or contact us for help.
placeholder-preview-image
Wix LearnImprove your skills with our courses and tutorials.
Wix BlogGet tips for web design, marketing and more.
SEO Learning HubLearn to increase organic site traffic from search engines.
Website developmentBuild a custom site using our full-stack platform.
Hire a ProfessionalGet matched with a specialist to help you reach your goals.
placeholder-preview-image
In this article
  • Access Widget API Properties
  • Access Properties Through the Settings Panel
  • Access Properties Through Code
  • Access Widget API Events
  • Access Widget API Functions

Wix Blocks: Using Your Widget API When Editing a Site

In this article
  • Access Widget API Properties
  • Access Properties Through the Settings Panel
  • Access Properties Through Code
  • Access Widget API Events
  • Access Widget API Functions
Wix Blocks is currently open to a limited number of users.
After a Widget API was defined in Blocks and the widget is now installed on a site, you can easily access the Widget API from the Wix Editor or Editor X. 

Learn more about using the Widget API when editing a site: 
Important
Any changes that you make to the API while editing a site, only impact this specific site. The original widget is not impacted. If this isn't your intention and you want to edit the Widget API so that it updates on all sites using the widget, edit it in Wix Blocks. 

Access Widget API Properties

Access Properties Through the Settings Panel

  1. Select the widget in the Wix Editor or Editor X.  
  2. Click Settings in the widget's action bar to access its properties. 
  3. Edit the properties in the Settings panel. Note: Your changes will only apply to the site you're editing.
  4. Click Preview to see how your widget works on this site. 
Important
If you did not define properties in your Widget API, you won't see the Settings button.
If you have created a custom panel for the Settings button, the default Settings panel with all your widget's properties won't be available. Learn more

Access Properties Through Code

  1. Select the widget in the Wix Editor or Editor X.
  2. Click the Properties and Events properties and events icon to view the widget's ID. 
widget api properties in editor x
  1. Use the syntax: $w("#<widget ID>)".property  to access properties (use extra dots if the property is an object and you want to access its inner properties). For example, let's log the name of our customer from the shopping widget to the console. 
1let name = $w("#widget11").existingCustomer.name;
2console.log(name);

Access Widget API Events

  1. Select the widget in the Wix Editor or Editor X.
  2. Click the Properties and Events properties and events icon to view available events. 
  3. Select the event you'd like to handle. 
  4. Use the empty event-handler function that appears in your code panel to write whatever should happen when the event is triggered. 
widget event handlers in editor x
Important
Note that the condition for firing the event was defined in Blocks, while the actions to take when catching the event are defined in the site that installed the widget. 
Learn more about defining your API events in Blocks.

Access Widget API Functions

1let productAddedToCart = $w('#widget11').addItemToCart(productID, quantity));
Access your Widget API functions in your site's code easily, with Velo's auto-complete. 
For example, when an item was successfully added to the cart - you can notify the user. 
Once you begin to write the functions name (such as "add"), Velo auto completes so you can see what functions are available:  
Learn more about the Blocks Widget API.

Helpmate

Hello

Need a bit more guidance?
Unlock personalized helpLog in to get the most out of Helpmate.