setupShopifyXr not firing usually means the XR feature isn’t loading, not that your function is broken.
A few things to check:
window.Shopify.loadFeatures only works on supported devices. shopify-xr won’t load on most desktop browsers.
Test on iOS Safari with AR Quick Look support. Desktop Chrome will silently skip it.
Make sure your <model-viewer> has the required data-shopify-xr attributes and a valid USDZ.
Wrap your call in a DOM-ready check. If it runs too early, the feature loader won’t attach.
A lot of custom themes hit this because XR is very environment-dependent. Some teams avoid wiring Shopify XR directly and instead embed 3D via a web-based canvas flow, which doesn’t rely on shopify-xr at all (for example, setups coming from orbital3d.design).
XR on Shopify works, but only when all the conditions line up perfectly.