Skip to content

Frequently Bought Together Section for Shopify

Shopify section that shows the current product with up to 3 picked products, checkboxes, variant selects, a live total and one button that adds everything checked to the cart.

Also known as: product bundle section, upsell products section, bought together widget, cross sell product bundle

Preview with sample data

Open in new tab

Liquid code

A frequently bought together section for Shopify: the current product shown beside up to three products you pick, with a checkbox for each, a running total and one button that adds everything checked to the cart. No app is needed.

How it works

You choose the paired products by hand in the theme editor, so the section shows exactly what you selected. It does not calculate which products are really bought together.

Each product is rendered as a .wds-fbt__item with its image, a checkbox, a variant select when it has variants, and its price. Changing a checkbox or a variant recalculates the total and updates the button label, and unchecked items are dimmed. Prices follow your store's money format.

The button sends every checked variant in one request to the Cart API. On success the shopper goes to the cart page. If Shopify refuses the request, its message is shown in an alert under the button and the shopper stays on the page.

Sold-out products are left out automatically and named in a short note, and sold-out variants are disabled in the select. If the current product's variant changes in the theme's own picker, the section follows it when it can find that form.

Customization

In the theme editor, the section is called WDS Bought together:

  • Products to pair with the current product: up to 3 products.
  • Heading, Subheading: the text above the products.
  • Current product prefix: the "This item:" text; leave it empty to hide it.
  • Button, one item checked, Button, several items checked: labels, where [count] becomes the number of checked items.
  • Total, Button while adding, Nothing checked, Sold-out variant, Unavailable products note, Connection error: the remaining messages.
  • Background, Text, Accent (button and checkboxes), Button text: colors.
  • Side padding, Top padding, Bottom padding: spacing.

Use cases

  • Stores with accessories and add-ons: pair a main product with up to three hand-picked complementary items
  • Average order value growth: shoppers check items, see a running total and add everything in one click
  • Products with variants: each paired item has its own variant select with sold-out options disabled
  • Product page upsells without an app: choose the pairings in the theme editor instead of installing an app

Accessibility

Checkboxes use real label elements, and each variant select has a label that names its product. The total is announced with aria-live="polite", errors use role="alert", and the button reports aria-busy while adding. Focus outlines are visible, and transitions are removed for prefers-reduced-motion.

Usage notes

It requires an Online Store 2.0 theme and a product template. On the live store it stays hidden until there is at least one other available product to show. Subscription-only products count as unavailable.

Limits to know about: pairings are set once per template, so every product using that template shows the same picks. No bundle discount is applied, and the total is simply the sum of the checked prices. Line item properties are not sent. The cart page always opens after adding, even if your theme has a cart drawer.

The preview uses sample data for an invented store, and adding is simulated with a demo message because the preview cannot reach a real cart. Photos in the preview are from Unsplash; section.liquid contains none and uses your product images.

Frequently Bought Together Section for Shopify at a glance

Framework
Shopify
Code
Liquid
JavaScript
A small script inside the section, no jQuery
Dependencies
fonts.googleapis.com
Layout
Responsive, works on mobile
Category
Product Details
License
Free for personal and commercial use

Questions about this section

Can I use the Frequently Bought Together Section for Shopify code for free?

Yes. You can copy or download the Liquid code and use it in personal and commercial projects, including client work. No sign-up is needed. Reselling it as part of a component library or template collection is not allowed; see the license.

How do I add it to my Shopify store?

Create a new section named shopify-frequently-bought-together in your theme code editor, paste the Liquid code and save. Then add the section to a page in the theme editor. It works with Online Store 2.0 themes.

Does it work on mobile?

Yes. The layout adapts to small screens. Use the Mobile and Tablet buttons above the live demo to check it at phone and tablet width.

How to install

  1. In your Shopify admin, go to Online Store > Themes, open the theme's menu and choose Edit code.
  2. Under Sections, add a new section named shopify-frequently-bought-together, replace its contents with the Liquid code above and save.
  3. Open the theme editor, choose Add section and add it to the page.

Requires an Online Store 2.0 theme. Try it on a copy of your theme first. WebDevSnippets is not affiliated with or endorsed by Shopify.

Frequently Bought Together Section for Shopify – free Shopify product detail page template
Frequently Bought Together Section for Shopify · free Shopify product detail page template

More Product Details

Bootstrap Product Page – free Bootstrap 5 product detail page template

Bootstrap Product Page

Bootstrap 5 product details page with image gallery, color and size pickers, quantity stepper, and tabs for description, specifications and customer reviews.

Product Detail with Gallery – free Tailwind CSS product detail page template

Product Detail with Gallery

Dark Tailwind CSS product page section with a thumbnail image gallery, finish options, quantity stepper and add to cart button with loading state.

Sticky Add to Cart Bar for Shopify – free Shopify product detail page template

Sticky Add to Cart Bar for Shopify

Shopify section: a bar fixed to the bottom of product pages that appears once the main add-to-cart button scrolls away, with image, price, variant select and a real product form.

Product Detail with Image Zoom Lens – free Tailwind CSS product detail page template

Product Detail with Image Zoom Lens

Tailwind CSS product detail section with a round magnifier lens that zooms the photo on hover or arrow keys, plus adjustable 2x to 4x levels.