Skip to main content
When a shopper finishes a try-on, the result screen shows one final CTA. data-hemsy-action on the script tag decides what it does. It applies to every launch mode, including Instant. Use cart when your storefront owns cart state and should add the returned variants itself — headless storefronts, Hydrogen, or any site with a custom cart drawer.
The legacy data-hemsy-mode="cart" still maps to the cart action for backward compatibility, but prefer data-hemsy-actiondata-hemsy-mode should be reserved for "instant". (data-hemsy-mode="checkout" has no effect; checkout is simply the default action.)

Event callbacks

Callbacks are configured on window.HemsyEmbedConfig (not data attributes). Define it before the embed script loads:
onItemAdded and onItemRemoved fire live as the shopper edits their bag, regardless of action. onProductVariantData is the cart handoff itself: the items array includes any line-item attributes from the original payload (bundle keys and so on), so pass them through to your cart.

Keeping the modal open

By default, Hemsy closes the modal after the cart handoff. Set data-hemsy-auto-close="false" on the script tag (or autoClose: false on HemsyEmbedConfig) to keep it open — for example if you show your cart drawer next to the modal.

Hydrogen example

variantId is the numeric Shopify variant ID as a string — convert it to GID format (gid://shopify/ProductVariant/...) for Hydrogen’s cart operations.