Skip to main content

Upcart

How to setup contribe with Upcart

Updated over 10 months ago

This is how you setup contribe with upcart

<script type="module">
const upcart = document.getElementById("upCart");

if (upcart) {
const element = upcart?.shadowRoot ?? upcart;
const target = element?.querySelector(".upcart-products-section");
const shopId = window?.Shopify?.shop ??window?.__NEXT_DATA__?.props?.pageProps?.shop

if (target) {
const plugin = document.createElement("contribe-plugin");
plugin.setAttribute("pluginId", shopId);
target.appendChild(plugin);

const script = document.createElement("script");
script.src = "https://plugins.contribe.io/cdn/v1/plugin.mjs";
script.type = "module";
document.head.appendChild(script);
}
}
</script>

Did this answer your question?