Skip to main content

Add Subi widget in Page Builders Apps

How to add Subi widget to pages you create on PageFly, GemPages, Ecomposer, etc.

Updated over a week ago

You can use the Subi widget SDK code to add the Subi widget to your product page template in most page builders apps.

Subi SDK Code [Subscribe and save widget]

{% assign target_product = product %}
<script id="render-subify-widget-{{ target_product.id }}">
console.log("ecom product",{{ product | json }})

function createSubifyBlock(){
const parent = document.getElementById("render-subify-widget-{{ target_product.id }}").parentElement;
const wrapper = document.createElement("div");
wrapper.className = "subify-app-block-wrapper product-{{ target_product.id }}";
parent.appendChild(wrapper);
}
function initSubifyBlock(){
createSubifyBlock();
function renderWidget(){
const selector = ".subify-app-block-wrapper.product-{{ target_product.id }}";
subifySdk.renderWidget({{ target_product | json }},{renderPosition:{wrapper:selector}})
}
if(window.subifySdk){
renderWidget();
}else{
window.addEventListener("subify:sdkLoaded",()=>{
renderWidget();
})
}
}
initSubifyBlock();
</script>

Subi SDK code [Membership, Bundle widget]

{% assign target_product = product %}

{% if target_product %}
<script
id="render-subify-widget-{{ target_product.id }}"
>
function initSubifyBlock() {
function getSubscriptionTypeSelector (subscriptionType) {
switch (subscriptionType) {
case "membership":
return 'subi-membership-app-block-wrapper';
case "fixed_bundle":
return 'subi-fixed-bundle-app-block-wrapper';
case "product_subscription":
return 'subify-app-block-wrapper';
}
};

function renderWidget() {
const product = {{ target_product | json}};
const productSubscriptionTypes ={% if specific_subscription_type != null %} ["{{ specific_subscription_type }}"] {% else %} new subifySdk.SubscriptionTypeDetector(product).getSubscriptionType(); {% endif %}

const customSetting = {% if widget_settings %} {{ widget_settings }} {% else %} { } {% endif %};

productSubscriptionTypes.forEach(subscriptionType => {
const selector = `.${getSubscriptionTypeSelector(subscriptionType)}.product-{{ target_product.id }}`;

{% if specific_subscription_type == null %}
if (document.querySelector(selector)) return;
{% endif %}

switch (subscriptionType) {
case "product_subscription":
subifySdk.renderWidget(product, {
renderPosition: {
wrapper: selector
},
...customSetting
})
break;

case "membership":

subifySdk.renderMembershipWidget(product, {
renderPosition: {
wrapper: selector
},
...customSetting
})
break;

case "fixed_bundle":
subifySdk.renderFixedBundleWidget(product, {
renderPosition: {
wrapper: selector
},
...customSetting,
})
break;
}

});
}

if (window.subifySdk) {

renderWidget();
} else {
window.addEventListener("subify:sdkLoaded", () => {

renderWidget();
})
}
}

initSubifyBlock();
</script>
{% endif %}

Overview

You can add the Subi subscription widget to your product pages built with PageFly to display subscription options and drive recurring sales. This guide shows you how to embed the widget and customize it to match your store’s design.


Steps to Add the Subi Widget in PageFly

  1. Open your product template in PageFly.

  2. From the left menu, click Add element.

  3. Select the HTML/Liquid element.

  4. Drag and drop the HTML element into your Product form (placing it above the Add to Cart button is recommended).

  5. Select the HTML element, then from the right menu, click Open code editor.

  6. Paste the Subi widget SDK code into the code editor modal and save.

  7. Make sure the template is assigned to a product with an active selling plan in Subi.

  8. Save your template.

Once these steps are complete, the Subi subscription widget will appear in your PageFly product template.


Customizing Your Widget

After adding the widget, you can further customize its appearance and functionality from your Subi dashboard to ensure it matches your store’s branding and layout.Add element:

Select the HTML/Liquid element.

Drag and drop the HTML element in your Product form. (preferably above your add to card button)

Select the HTML element, and From the right side menu, click on Open code editor.

Paste the Subi widget SDK code into the modal and save.

Subi's subscription widget will be added to the product template created with PageFly.

You can then customize your widget from your Subi panel, to match the look and feel of your template:

Overview

Adding the Subi subscription widget to your product pages in GemPages lets you showcase subscription options directly to customers. Follow these steps to add the widget and tailor its look to your store’s design.


Steps to Add the Subi Widget in GemPages

  1. Open your product template in GemPages.

  2. Make sure the template is assigned to a product with an active selling plan in Subi.

  3. From the left menu, click Element.

  4. Select the Custom Code element.

  5. Drag and drop the Custom Code element into your Product form (it’s recommended to place it above the Add to Cart button).

  6. Select the Custom Code element and, from the left menu, paste the Subi widget SDK code into the HTML modal.

  7. Save your template and Publish the template.

Once published, the Subi subscription widget will appear in your GemPages product template.


Customizing Your Widget

After adding the widget, you can customize its appearance and settings from your Subi dashboard so it matches the look and feel of your template.

Screenshots

From the left side menu, click on Element:

Select the Custom Code element and drag and drop the Custom Code element in your Product form. (preferably above your add to cart button)

Select the Custom Code element, and from the left side menu, paste the Subi widget SDK code into the HTML modal:

Save your template and publish the page to view the widget.

Subi's subscription widget will be added to the product template created with GemPages. You can then customize your widget from your Subi panel to match the look and feel of your template:

Overview

You can add the Subi subscription widget to your Replo product pages to showcase subscription options directly to your customers. This guide walks you through embedding the widget and making sure it matches your store’s style.


Steps to Add the Subi Widget in Replo

  1. Open your product template in Replo.

  2. Make sure the template is assigned to a product with an active selling plan in Subi.

  3. From the left menu, click Components.

  4. Select the Custom Code component.

  5. Drag and drop the Custom Code component into your Product form (placing it above the Add to Cart button is recommended).

  6. Select the Custom Code component and, from the right menu, click Config.

  7. Click Launch Code Editor.

  8. Paste the Subi widget SDK code into the Code Editor modal.

  9. Save your template.

After saving, the Subi subscription widget will appear in your Replo product template.


Customizing Your Widget

Once the widget is installed, you can further customize its design and behavior from your Subi dashboard to match the look and feel of your store.

Screenshots

From the left side menu, click on Components:

Select the Custom Code component:

Drag and drop the Custom Code component in your Product form. (preferably above your add to cart button)

Select the Custom Code component, and from the right side menu, click on Config:

Click on Launch Code Editor, and Paste the Subi widget SDK code into the Code Editor modal.

Save your template.

Subi's subscription widget will be added to the product template created with GemPages.
You can then customize your widget from your Subi panel to match the look and feel of your template:

Did this answer your question?