Subify SDK
  • Subify SDK for developers
    • Loading SDK
    • `subifySDK` Object Methods
      • renderWidget(product, configs)
      • changeVariant(targetProductId, selectedVariantId)
    • Events
Powered by GitBook
On this page
  • subify:sdkLoaded
  • subify:variantChange
  • subify:sellingPlanChange
  1. Subify SDK for developers

Events

subify:sdkLoaded

This event will be triggered when sdk is successfully loaded.

window.addEventListener("subify:sdkLoaded",()=>{
  //sdk is loaded and you can access to 'window.subifySdk'
   })

Please note that this event is only triggered when the Subify SDK has not yet been loaded. If you listen to this event after the Subify SDK has been loaded, it won't be triggered. You can check “window.subifySdk” to determine whether the SDK has been loaded previously.

subify:variantChange

This event will be triggered when sdk detects variant selection.

 window.addEventListener("subify:variantChange", (event) => {
//you have access targetProductId and selectedVariantId in event.detail
      const { targetProductId, selectedVariantId } = event.detail;

    });

event.detail

targetProductId

(number) The ID of the product whose variant has changed.

selectedVariantId

(number) the ID of new selected variant

subify:sellingPlanChange

This event will be triggered when the user changes a subscription option in the widget.

window.addEventListener("subify:sellingPlanChange", (event) => {
//you have access targetProductId and selectedSellingPlan in event.detail
      const {targetProductId, selectedSellingPlan } = event.detail;

    });
    

event.detail

targetProductId

(number) The ID of the product whose selling plan has changed.

selectedSellingPlan

PreviouschangeVariant(targetProductId, selectedVariantId)

Last updated 1 year ago

Selected selling plan that is a Shopify or null if the user selects one time purchase option

selling plan object