| [ Web Proxy ] |
| Viewing: https://docs.getrecharge.com/docs/using-quick-view-with-the-subscription-widget | [Back] [Original] |
Some Shopify themes have a quick view feature that lets customers view product details from a pop-up window or modal, without having to navigate to the full product page. The quick view feature is typically available with paid themes, however, there are apps like Quick View & Color Swatch by Globo, Quick View by Secomapp, or Product Quick View by qikify that let you use the feature on most Shopify themes. Paid themes that offer the quick view feature are currently developed by Archetype or Maestroo.
This guide explains how to ensure quick view works with the Recharge Subscription Widget.
Archetype themes use JavaScript to dynamically load content in their Quick View modals. This means that scripts, including the Subscription Widget, dont automatically run when the modal opens.
To ensure the Recharge widget loads correctly, follow these steps:
In your Shopify theme editor:
<script>
(function () {
// Watch for the Archetype event for the quickview loading
document.addEventListener("quickview:loaded", function (evt) {
const widget = document.querySelector(".recharge-subscription-widget");
// redo leading all the widget scripts
reExecuteScripts(widget);
// reload the web component
reRenderWebComponent(widget.querySelector("recharge-subscription-widget"));
});
// generic function that reloads a dom element on the page
function reRenderWebComponent(element) {
if (!element) return;
const newEl = element.cloneNode(true);
element.replaceWith(newEl);
}
// generic function that re-appends script tags on the page to force them to reload
function reExecuteScripts(container, attrReplace = (attr) => attr.value) {
const scripts = container.querySelectorAll("script");
scripts.forEach((oldScript) => {
const newScript = document.createElement("script");
// Copy attributes
for (const attr of oldScript.attributes) {
newScript.setAttribute(attr.name, attrReplace(attr));
}
// Copy inline code if any
if (oldScript.textContent) {
newScript.textContent = oldScript.textContent;
}
// Replace the old script with the new one
oldScript.parentNode.replaceChild(newScript, oldScript);
});
}
})();
</script>This forces the widget to reload all the scripts and re-render the widget.
Maestroo themes are fully compatible with Recharge out of the box. No additional setup is needed for the widget to work inside Quick View modals..
The Subscription Widget is not officially compatible with third-party Quick View apps. Some apps may support the widget out of the box, while others require additional integration work:
Updated about 1 year ago
| Web Proxy Viewer | New URL | Original Page |