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 name | Type | Description |
---|---|---|
externalProductId | string | This is the Shopify Product ID of the Product that is used to create Bundles |
externalVariantId | string | This is the Shopify Variant ID of the Variant that is used to create Bundles |
selections | array | This is an array containing objects that represent the selections of the Bundle |
selections[].collectionId | string | This is the Shopify Collection ID that contains the product. Please make sure this is allowed by your Bundle in the configuration |
selections[].externalProductId | string | This is the Shopify Product ID of the selected product |
selections[].externalVariantId | string | This is the Shopify Variant ID of the selected product |
selections[].quantity | number | The 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 bundlebundleSettings.variants[].items_count
is the number of items for this variantbundleSettings.variants[].option_sources
are the collections where products can come fromoption_source.quanity_min
&option_source.quantity_max
if notnull
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 bundlebundleSettings.variants[].items_count
is the number of items for this variantbundleSettings.variants[].option_sources
are the collections where products can come fromoption_source.quanity_min
&option_source.quantity_max
if notnull
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;
}[];
};
- fetch
getDynamicBundleItems
for a given bundle - getDynamicBundleItems - add bundle items to your cart