Skip to main content

Is there a callback I can use when Swatch King has loaded?

Updated over a year ago

For integrating or running custom scripts with Swatch King, you can rely on the presence of the window.VariantSwatchKing global variable as an indicator that Swatch King has been successfully loaded and is operational on your site.

Additionally, Swatch King emits several custom events that provide further insight into its operations:

  • vsk:render:swatches: Triggered to render collection swatches, useful in dynamic content scenarios manually.

  • vsk:variant:changed: Fired when there's a change in variant selection on a product card, carrying details about the newly selected variant.

  • vsk:product:changed: Similar to the variant changed event, this is triggered upon changes in the product, providing information on the updated product.

These custom events allow you to precisely tailor your site’s functionality and user interactions based on Swatch King’s status and activities.

For any additional queries or technical support, please reach out to our support team.

Did this answer your question?