Skip to content

"recommendation" event

Event@tryyoursize/sdk

The shopper’s recommended size for this product, in your size labels: on mount when the shopper is already connected, and on every change. Sizes only, never measurements.

The size guide element always listens; for other elements, adding a handler starts it. Preselect your picker, but never override a size the shopper picked themselves.

recommendation: Recommendation;
productstringRequired
statusRecommendationStatusRequired

ready, computing, none, signed_out or unavailable. See tys.recommendation().

sizestring | nullRequired

The recommended size in the store's own label (its size map), or null.

studioSizestring | nullRequired

The same size as entered in TryYourSize Studio, or null.

wearableSizesstring[]Optional

Sizes that can be worn on this body, in the store's labels (when simulated).

let touched = false;
sizePicker.addEventListener("change", () => (touched = true));
guide.on("recommendation", (r) => {
if (r.status === "ready" && !touched) sizePicker.value = r.size;
});

Was this page helpful?