Bundles & Upsell
<BundleUpsell> renders a fixed list of products with one "add bundle to cart" action and a summed total. It's a rendering pattern. It doesn't try to be a bundling engine, because Shopify has no single definition of what a "bundle" is. This guide covers the three ways to source the item list: Shopify's own product-recommendations query switched to COMPLEMENTARY intent, a merchandiser-picked metafield, or Shopify's native product Bundles feature for a true multi-SKU bundle product.
It's for a developer wiring up a "frequently bought together" or "complete the look" section on a product page. Afterwards you'll know which of the three sourcing options suits a given store, how computeBundleTotal handles mixed currencies or a missing price without showing a wrong total, and where <BundleUpsell> stops being the right component (a true native Bundle product renders normally on its own PDP instead).
Before you start: read the related-products note in Architecture first, since Option 1 builds directly on the same productRecommendations query used there.
Related: Architecture for the underlying recommendations query, and B2B-Ready Data Layer for another feature guide that ships a pattern and leaves the engine to you.
Source: docs/guides/bundlesUpsell.md
<BundleUpsell> (app/components/BundleUpsell.tsx) renders a fixed list of products together ("frequently bought together," "complete the look," a curated starter kit) with a single "Add bundle to cart" action that adds every item's variant in one AddToCartButton submission (AddToCartButton already accepts multiple lines, so no new cart plumbing is needed). It also shows a summed bundle total via computeBundleTotal (app/lib/bundle.ts) when every item shares a currency.
Why this is a pattern and leaves the bundling to you
Shopify doesn't have one universal "bundle" primitive. What a bundle is varies by store: some just want a "frequently bought together" rail driven by real purchase data, some want a merchandiser-curated set (new product + its refill, a starter kit), and some are selling an actual multi-SKU bundle product created with Shopify's native Bundles functionality. <BundleUpsell> and computeBundleTotal only deal with rendering a list of BundleUpsellItems and adding them to cart together. Sourcing that list is store-specific, so it isn't baked in. The three options below are the natural ways to source it; pick whichever matches what the store actually needs, or mix them on different pages.
Option 1: Complementary product recommendations
The simplest option, and the one this template already has the infrastructure for: products.$handle.tsx already queries productRecommendations(productId:) for the "You may also like" section (see docs/ARCHITECTURE.md's related-products note). That query accepts an intent argument. Switch it (or add a second query) to COMPLEMENTARY instead of the default, and Shopify's own recommendation engine will favor items that tend to sell alongside the current product, which is exactly a "frequently bought together" rail:
query BundleRecommendations($productId: ID!) {
productRecommendations(productId: $productId, intent: COMPLEMENTARY) {
id
title
handle
featuredImage {
url
altText
}
priceRange {
minVariantPrice {
amount
currencyCode
}
}
selectedOrFirstAvailableVariant(selectedOptions: []) {
id
}
}
}
Map the response into BundleUpsellItem[] (id, variantId, handle, title, image, price) and pass it straight to <BundleUpsell>. There's no new data model and no merchandiser workflow, just a different intent on a query you already have.
Option 2: A curated metafield
If a merchandiser needs to hand-pick the bundle (a specific accessory with a specific product, regardless of what the algorithm would suggest), store the paired product/variant GIDs in a list metafield on the product (e.g. a custom.bundle_with list-of-product-references metafield set in the Shopify admin), then query it alongside the product:
query ProductWithBundle($handle: String!) {
product(handle: $handle) {
metafield(namespace: "custom", key: "bundle_with") {
references(first: 5) {
nodes {
... on Product {
id
title
handle
featuredImage {
url
altText
}
priceRange {
minVariantPrice {
amount
currencyCode
}
}
selectedOrFirstAvailableVariant(selectedOptions: []) {
id
}
}
}
}
}
}
}
This is the right choice when the pairing is a merchandising decision instead of a data-driven suggestion. A metafield gives the merchant a plain admin UI to manage it without touching code.
Option 3: Shopify's native product bundles
If the store uses Shopify's own Bundles feature (a single bundle product made up of component products/variants), the bundle is a product. Query it like any other product, and read its components through the bundleComponents/requiresComponents fields the bundle product exposes instead of assembling a BundleUpsellItem[] by hand. In this case <BundleUpsell>'s multi-line "add everything at once" model doesn't apply the same way, since the bundle itself is a single purchasable variant. You'd render the bundle product normally on its own PDP (ProductForm already handles a single variant + AddToCartButton fine) and reserve <BundleUpsell> for cross-sell rails that suggest other products alongside it.
Using <BundleUpsell>
However you source the list, shape each entry as a BundleUpsellItem (app/lib/bundle.ts) and render it:
import {BundleUpsell} from '~/components/BundleUpsell';
<BundleUpsell
heading="Frequently bought together"
items={[
{
id: product.id,
variantId: product.selectedOrFirstAvailableVariant.id,
handle: product.handle,
title: product.title,
image: product.featuredImage,
price: product.priceRange.minVariantPrice,
},
// ...more items
]}
/>;
computeBundleTotal returns null if any item is missing a price or the items don't all share a currency. That hides the "Bundle total" line so a wrong total never shows. Both cases are real possibilities depending on where the list came from, so <BundleUpsell> degrades gracefully instead of throwing.