Resolution modes
Path template
Use a path template when product routes have a consistent structure.:handle when matching handles and :product_id when matching external product IDs.
Last path segment
Use this only when the final path segment is always the product handle or ID.Query parameter
Use this for routes that expose a stable product identifier in the query string.sku and match by Product ID.
Custom regex
Use a custom regular expression only when the standard modes cannot represent the route. The first capture group becomes the product hint.Test the rule
In virtual.fit’s Live URL Tester:- Paste an absolute URL from the real storefront.
- Confirm the extracted value.
- Confirm the matched product title and ID.
- Confirm the message says the product is enabled.
- A valid enabled product.
- A valid disabled product.
- An unknown product.
- A collection or search page.
- A localized route, if your storefront uses locales.
Manual product context
For SPAs, query-driven PDPs, or routes that cannot be expressed by a rule, callsetProduct after initialization:
id or handle must still identify a synced, enabled product. Manual context does not bypass its availability settings in virtual.fit.
Call setProduct again after your router commits each new product page and whenever the selected variant changes.
Color and style variants
Keep one synced product ID for the product. Sync exact variants under it, including variant media when color, pattern, material, or style changes the garment.variantId must match a source_variant_id synced under the product. variantImageUrl is a display hint; virtual.fit uses the canonical prepared media linked to the variant.
Size-only variants usually share the product’s media. You can still send their variantId so availability and inventory refer to the exact purchasable combination.
Do not create duplicate product records for each color or size. One product with exact variants keeps recommendations product-level while still allowing virtual.fit to select the best in-stock visual variant.
Fail-closed behavior
The widget stays hidden when:- The rule extracts no value.
- The value does not match a synced product.
- The matched product is disabled.
- The matched product has no usable garment images.