Skip to main content

Overview

info
  • These Bundles functions can only be called from the browser within your Shopify storefront domain otherwise they will not work.

  • Recharge has added bundles APIs to the Recharge API and our storefront API methods. Please see Bundles and Bundle Selections.

The Bundles section encapsulates all the methods that access the Bundling engine in Recharge. You can use these methods to build custom experiences in your store to build bundles.

For more in depth examples see our bundles examples.

Bundle structure

A Bundle consists of an object with the following attributes that are all required:

Attribute nameTypeDescription
externalProductIdstringThis is the Shopify Product ID of the Product that is used to create Bundles
externalVariantIdstringThis is the Shopify Variant ID of the Variant that is used to create Bundles
selectionsarrayThis is an array containing objects that represent the selections of the Bundle
selections[].collectionIdstringThis is the Shopify Collection ID that contains the product. Please make sure this is allowed by your Bundle in the configuration
selections[].externalProductIdstringThis is the Shopify Product ID of the selected product
selections[].externalVariantIdstringThis is the Shopify Variant ID of the selected product
selections[].quantitynumberThe number of items of this product that the customer selected

Example Static Bundle workflow

  • fetch bundleSettings for product - getCDNBundleSettings
  • use bundleSettings data to create a bundle
    • bundleSettings.variants[].items_count is the number of items for this variant
    • bundleSettings.variants[].option_sources are the collections where products can come from
    • option_source.quanity_min & option_source.quantity_max if not null define the min/max qantity from that collection
//Bundle Object:
const bundle = {
externalVariantId: string; // variant selected from bundle data
externalProductId: string; // bundle product id
selections: {
collectionId: string; // collection_id from variant - shopify collection id
externalProductId: string; // product id from above shopify collection
externalVariantId: string; // variant id from above product
quantity: number; // number of items - must obey option_source quanity_min/quanity_max if defined
}[];
};
  • fetch bundleId for a given bundle - getBundleId
  • add bundle id as a line item property in the cart

Example Dynamic Bundle workflow

  • fetch bundleSettings for product - getCDNBundleSettings
  • use bundleSettings data to create a bundle
    • bundleSettings.variants[].items_count is the number of items for this variant
    • bundleSettings.variants[].option_sources are the collections where products can come from
    • option_source.quanity_min & option_source.quantity_max if not null define the min/max qantity from that collection
//Bundle Object:
const bundle = {
externalVariantId: string; // variant selected from bundle data
externalProductId: string; // bundle product id
selections: {
collectionId: string; // collection_id from variant - shopify collection id
externalProductId: string; // product id from above shopify collection
externalVariantId: string; // variant id from above product
quantity: number; // number of items - must obey option_source quanity_min/quanity_max if defined
// Onetime properties
// SCI Stores
sellingPlan: number; // child product selling plan id
// RCS Stores (intervals must match across selections if defined)
shippingIntervalFrequency: number; // selling plan interval frequency
shippingIntervalUnitType: IntervalUnit; // selling plan interval unit
discountedVariantId: number;
}[];
};