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.38.0 write bundle id Types

Generate a _rb_id for a bundle selection.

The _rb_id value is used in checkout orders for fixed-price Bundles and must be added as a property of the cart line item associated with a Bundle. Recharge uses this value to extract the selected items from the Bundle. There should be one _rb_id per Bundle line item, with a new _rb_id required for each additional Bundle line item in the cart.

The required scope for this endpoint is write_bundle_id, which is available in the storefront token generation view under the "Bundle rb Id Generation" permission.

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