Smind Documentation
  • In-app
    • Getting started
    • Library
      • Product blocks
      • Sections
      • Templates
      • Themes
      • Styles
    • My library
    • Page Builder
    • Theme Builder
    • Subscription plans
    • Settings
    • Support
  • Guides
    • Color block and color scheme
    • Enabling account
    • Getting Google Maps iframe
    • Getting TikTok video URL
    • Configuring color swatches
    • Configuring sale badge
    • Configuring size chart
    • Showing social media icons
    • Deleting data
    • Moving Sections
  • Sections
    • Header
    • Product Detail
    • Product Bundles
    • Collection Page
      • Vertical Layout
      • Horizontal Layout
      • Off-Canvas Layout
      • Expand/Collapse Layout
    • Wishlist & Wishlist Page
    • Compare & Compare Page
    • Quick Add
    • Quick View
  • Cart Drawer
    • Estimate Shipping
    • Free Shipping Progress Bar
    • Complementary Product
    • Cart Notes
  • FAQs
    • Why does the section appear on all pages?
    • Why are section layouts broken?
    • Why do spaces appear when hiding the theme's header?
    • How to change default text in sections?
    • How to update sections?
    • How to set the default template for product pages?
    • Why are the sections I installed not showing up in the theme editor?
    • Integrate review scores from other apps.
  • Dev
    • Product detail event
    • Product form event
    • Cart Drawer event
Powered by GitBook
On this page
  1. Dev

Product detail event

Variant has changed

PreviousIntegrate review scores from other apps.NextProduct form event

Last updated 1 month ago

  • Selecting variant from variant picker of Smind

This event is fired whenever a user has changed the variant in a product selector, either in a product page, featured product section or quick view and quick add section

variant:change

variant: Is an object variant of Shopify ()

The "change variant" event will be listened to by other components to update related elements such as product price, inventory status, SKU, add to cart button, and checkout.

Example usage:

document.addEventListener('variant:change', ({ detail: event }) => {
    try{
        const variant = event.variant;
        const variantId = event.variant?.id;
        console.log(variant);
        console.log(variantId);
    } catch (error) {
        console.log('error: ', error)
    }
});

  • Changing the product variant without using Smind’s variant picker.

If you're replacing the variant selection using Smind’s variant picker with a third-party solution, please make sure to dispatch an event after selecting a variant so that other components can listen for the variant change.

Example usage:

container.dispatchEvent(new CustomEvent("variant:change", {
    detail: {
      variant
    },
    bubbles: true
  }));

The section container that includes the variant picker

Object variant that selected

The variant change event must be named "variant:change" and must include a variant object with the same structure as Shopify's default variant object. ()

detail: {variant}
container
variant
https://shopify.dev/docs/api/liquid/objects/variant
https://shopify.dev/docs/api/liquid/objects/variant