Enable Selling Plan Data from Shopify Directly

Rebuy now supports subscription selling plans from all subscription apps that manage Shopify selling plans! Rebuy will now be pulling in the product selling plan information directly from Shopify. This allows Rebuy to use the selling plan data from all subscription services available through Shopify. Using this method, you can now use subscription features in Rebuy widgets and the Smart Cart.

To enable this feature live you can navigate to rebuyengine.com/settings and find the setting for "Enable Shopify Selling Plans" near the top of the settings. By toggling this to "Yes", Rebuy will know to pull in additional selling plan data for products that have selling plan information and add it to the Rebuy product object. Below are areas in which you can find this new data.

Enable Selling Plans in a SandBox Environment

The below code snippet will allow you to enable the return of selling plan data whenever a widget or the Smart Cart has subscription features enabled. This allows you to test these features in a sandbox environment such as a development theme. It is suggested to wrap this snippet in a script tag and place at the bottom of the body of your theme.liquid file.

document.addEventListener('rebuy.loaded', function(event){
  
  // Tell Rebuy to pull in selling plan data when available
  window.Rebuy.shop.shopify_selling_plans_enabled = true;
});

Below are two areas where you can find this selling plan data. In order get this data on the Rebuy Cart object you will need to have the Smart Cart enabled and Switch to Subscription enabled within the Smart Cart.

Alternatively you can run the enrichCart function from the Cart class in the console. Rebuy.Cart.enrichCart();

// Product level selling plan groups
Rebuy.Cart.cart.items[0].product.selling_plan_groups;

// Variant seleve selling plan allocations
Rebuy.Cart.cart.items[0].product.selected_variant.selling_plan_allocations;

📘

Transition from Recharge integration

If you are currently using the Recharge integration and have any custom code written around subscriptions then it is suggested to utilize the ability to test in a sandbox environment. This way you can ensure that any custom code will work with the format of data that we are getting back from Shopify directly. There are differences in the data format along with the introduction of selling plan allocations on the variant level. Currently we are not getting any variant level allocations back from the Recharge integration.