Skip to main content

Bundle Selections

Methods to work with Recharge bundle selections.

listBundleSelections v1.0.0 read subscriptions Types

Get a paginated list of bundle selections for the user.

import { listBundleSelections } from '@rechargeapps/storefront-client';
await listBundleSelections(session, {
limit: 25,
sort_by: 'id-asc',
});

getBundleSelection v1.0.0 read subscriptions Types

Get a bundle selection by bundle selection ID.

import { getBundleSelection } from '@rechargeapps/storefront-client';
await getBundleSelection(session, 123);

createBundleSelection v1.0.0 write subscriptions Types

Create a new bundle selection.

import { createBundleSelection } from '@rechargeapps/storefront-client';
await createBundleSelection(session, {
purchase_item_id: 106841871,
items: [
{
collection_id: '6948805869631',
collection_source: 'shopify',
external_product_id: '6949187452991',
external_variant_id: '39689109405759',
quantity: 1,
},
{
collection_id: '6948806688831',
collection_source: 'shopify',
external_product_id: '6949187452991',
external_variant_id: '39689109405759',
quantity: 2,
},
],
});

updateBundleSelection v1.0.0 write subscriptions Types

Update an existing bundle selection by bundle selection ID.

import { updateBundleSelection } from '@rechargeapps/storefront-client';
await updateBundleSelection(session, 123, {
purchase_item_id: 106841871,
items: [
{
collection_id: '6948805869631',
collection_source: 'shopify',
external_product_id: '6949187452991',
external_variant_id: '39689109405759',
quantity: 2,
},
{
collection_id: '6948806688831',
collection_source: 'shopify',
external_product_id: '6949187452991',
external_variant_id: '39689109405759',
quantity: 1,
},
],
});

deleteBundleSelection v1.0.0 write subscriptions Types

Delete a bundle selection by bundle selection ID.

import { deleteBundleSelection } from '@rechargeapps/storefront-client';
await deleteBundleSelection(session, 123);

getBundleSelectionId v1.0.0 write bundle id Types

Generate a bundle selection ID for a bundle configuration.

This method generates a bundle selection ID that can be used for bundle checkout processing. The method validates the bundle configuration before generating the ID.

import { getBundleSelectionId } from '@rechargeapps/storefront-client';
await getBundleSelectionId(session, {
externalProductId: '7134322196677', // Bundle's Shopify Product ID
externalVariantId: '41291293425861', // Bundle's Shopify Variant ID
selections: [
{
collectionId: '288157827269', // Shopify Collection 1
externalProductId: '7200061391045', // Shopify Product ID 1
externalVariantId: '41510929465541', // Shopify Variant ID 1
quantity: 2,
},
{
collectionId: '285790863557', // Shopify Collection 2
externalProductId: '7200062308549', // Shopify Product ID 2
externalVariantId: '41504991412421', // Shopify Variant ID 2
quantity: 1,
},
],
});