When you create a VIP plan from the Subscribfy admin panel, all plan details are saved into Shopify metafields under:
π Metafield Location: shop.metafields.exison.exison_plan_settings
π More Info: Shopify Metafields Set by Subscribfy
To allow customers to join the VIP program, you need to add the VIP product to the cart using a widget.
π Required Data from Metafields:
id β VIP product IDvariant_id β VIP product variant IDselling_plan β Subscription plan IDπΉ Example JavaScript Code to Add VIP Product to Cart:
// Add VIP product to cart
let formData = {
'items': [
{
selling_plan: exison_plan_settings.plan_id,
id: exison_plan_settings.product_variant_id,
quantity: 1,
sections: []
}
]
};
fetch('/cart/add.js', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(formData)
})
.then(response => response.json())
.then(data => {
console.log('VIP product added to cart:', data);
})
.catch(error => {
console.error('Error adding VIP product:', error);
});
πΉ Optional: Hide the VIP product from the cart items list to make it invisible to customers.
If the customer chooses not to join the VIP program, clicking βNon-Memberβ in the widget should:
πΉ Example JavaScript Code to Remove VIP Product from Cart: