· 15 min read

How to Create Buy X Get Y Discounts in Shopify (Buy a Bike, Save on Accessories)

Build a Buy X Get Y discount in Shopify step by step: buy a bike, save 15% on accessories, leave out items already on sale, and list the accessories on the bike's page.

Build a Buy X Get Y discount in Shopify step by step: buy a bike, save 15% on accessories, leave out items already on sale, and list the accessories on the bike's page.

One of our merchants runs a bike shop, and they wanted a Buy X Get Y discount: buy a bike, save 15% on accessories.

They were already listing a few accessories on each bike’s page with an upsell app. That list was hand-picked, capped at five items, and set up separately from the discount it advertised. They wanted the list to come straight from the discount, with every accessory the discount covers. And they wanted to choose which accessories show up on which bikes, so a commuting hybrid lists panniers and a road bike doesn’t.

I’m going to show you how to build this in Discount Bot one step at a time. Here’s a quick look at the finished setup, so you know what we’re building toward. It’s two discounts, one for hybrid bikes and one for road bikes:

The finished Super Discount: a hybrid bike discount and a road bike discount in one list, set to Apply maximum

And here’s the cart it produces. A hybrid bike at full price, with a pair of panniers, fenders and a light, each 15% off:

Cart with the FX 2 Stepover Gen 4 at full price, and the panniers, fenders and light each 15% off

Shopify’s built-in Buy X Get Y discount can’t leave out items that are already on sale, and customers don’t see it until it shows up in their cart. Discount Bot solves both: its Super Discount can leave out items already on sale, and its product page widget shows customers the offer while they’re still looking at the bike. Everything below is built with those two.

Discount 1: Buy a bike, save 15% on accessories (a Buy X Get Y discount)

Our merchant wanted every accessory in the cart to get 15% off, as long as there’s a bike in it.

In Discount Bot, create a Super discount and set Method to Automatic discount, so customers don’t need a code. Then give it a title. Ours is “Buy a bike, save 15% on accessories”, and customers will see it in their cart and at checkout:

The Super discount with Method set to Automatic discount and the title Buy a bike, save 15% on accessories

Click Add discount. The discount class is already Product. Add one condition, choose Specific collections, and pick Bikes. Leave Minimum requirements on No minimum requirement, which means the cart needs at least one bike:

One condition: any items from Bikes, with no minimum requirement

The bike is what the customer buys. Now set what they get. Under What this rule discounts, choose Different items (Buy X Get Y), and a Customer gets section appears. Choose Specific collections and pick Bike accessories. Then, under How the discount applies, choose To all matching items, so every accessory in the cart gets the discount, however many there are:

What this rule discounts set to Different items (Buy X Get Y), Customer gets set to Bike accessories, and To all matching items chosen

Set the discount to 15% and save. It shows up in the list as “15% off all matching Bike accessories”, marked Buy X Get Y, and under it, “Cart has any items from Bikes”:

The discount in the list: 15% off all matching Bike accessories, Cart has any items from Bikes

If a customer puts a bike, a pair of panniers and a front light in their cart, the bike stays at full price, and the panniers and the light are 15% off:

Cart with the Madone SL 5 Gen 8 at full price, and the Back-Roller panniers and the Blinder 600 light, both 15% off

Now try to break it. Take the bike out, and the panniers and the light go back to full price:

Cart with the panniers and the light at full price

Here’s one more cart a customer could easily put together: a bike and a pair of Oceanwave panniers, already marked down from $250.00 to $199.95. The discount takes another 15% off their sale price, so they come to $169.96:

Cart with the bike at full price and the on-sale Oceanwave panniers 15% off their sale price

Leave out accessories that are already on sale

Our merchant’s offer is for regular-price accessories only. But the discount we’ve built so far covers every accessory, including ones already marked down, like the Oceanwave panniers above. To leave those out, open the discount, click Add an exclusion under Customer gets, and choose On-sale items:

Customer gets: Bike accessories, excluding On-sale items

The discount in the list now says “15% off all matching Bike accessories (excluding on-sale items)”:

The discount in the list, now excluding on-sale items

Let’s test it with a bike, the on-sale Oceanwave panniers and a regular-price pair of Back-Roller panniers. The Oceanwave panniers stay at their sale price of $199.95, and only the Back-Roller panniers get 15% off:

Cart with the bike at full price, the on-sale Oceanwave panniers at their sale price, and the Back-Roller panniers 15% off

Discount Bot checks whether an item is on sale by looking at its compare-at price at the moment the cart is checked. If you take products on and off sale often, you won’t have to come back and edit the discount every time you do.

List the accessories on the bike’s page

This is the part our merchant was waiting for. They also wanted the offer, and every accessory it covers, on the bike’s page, so customers don’t miss it.

The discount you’ve built so far already works in the cart and at checkout. But nobody knows about the offer until they happen to put a bike and an accessory in their cart together, and find the 15% off by surprise. The product page widget is an add-on that tells them before they get there. It reads everything from the discount, so the discount stays the one place you set the offer up.

Look under your list of discounts. Show on product pages is already ticked on a new Super discount, and each discount says whether the product page widget can show it:

The discount with the line Can be shown in the product page widget, and Show on product pages ticked

The widget is a block you add to your theme once. If it isn’t there yet, the line under the checkbox says “The product page widget isn’t added to your theme yet.” Click the link in that line, or Add product page widget on the app’s dashboard, and your theme editor opens with the Product offers block added. Drag it above your Add to cart button and save. Once it’s in, the line says “The product page widget is already added to your theme.” If your bikes use their own product template, add the block to that template as well.

Here’s a bike’s page with the widget. The section has the discount’s name as its title, and each accessory shows its price with the 15% off, beside the regular price:

The Madone SL 5 Gen 8 product page with the Buy a bike, save 15% on accessories section above Add to cart

When we showed this to our merchant, they asked two questions. You may have the same ones.

Where does the list come from? It’s built automatically from the discount: everything in Customer gets, minus what you’ve excluded. Change the discount, and the list changes with it. There’s nothing to update in the widget, so it can’t fall out of sync. The same goes for your collections. Add a light to your Bike accessories collection, and it shows up on every bike’s page. Put an accessory on sale, and it drops off the list, because your discount leaves out on-sale items and the widget adjusts its list on its own.

Does it show up on every product’s page at once? No. The widget only appears on the pages of products that meet the discount’s condition. Our helmets aren’t in Bikes, so a helmet’s page shows nothing. If you’d like to try it on a few bikes first, set the condition to those bikes, and switch it to the whole collection when you’re happy with it.

Here’s how a customer uses it. They click Add next to an accessory, and choose a size where the accessory comes in more than one:

The widget with the Back-Roller panniers added and the Aero Wedge Pack's size choices open

The price updates with the size they pick. The Medium saddle bag is $40.37, down from $47.49:

The widget with two accessories added: the Back-Roller panniers and the Aero Wedge Pack in Medium

Then they click the page’s own Add to cart. The bike and both accessories go into the cart together, with 15% off the accessories:

Cart with the bike at full price, and the Aero Wedge Pack in Medium and the Back-Roller panniers, both 15% off

One thing to know: the widget adds the accessories together with the bike. If a customer already has the bike in their cart and comes back for a light, adding it from the bike’s page puts a second bike in the cart too. They can add the light from its own page instead, and it still gets 15% off while the bike is in the cart.

Discount 2: Panniers and fenders for hybrid bikes only

Our merchant wanted to choose which accessories show up on which bikes, so customers aren’t overwhelmed. Panniers and fenders suit a commuting hybrid, and they look out of place next to a road bike.

The widget lists exactly what a discount covers, so this takes a second discount. Here’s the plan:

  • Change the first discount so it’s for hybrid bikes only. Hybrids keep every accessory.
  • Duplicate it, and change the copy so it’s for road bikes, without panniers and fenders.

Open the first discount and change its condition from Bikes to Hybrid bikes. Nothing else changes, so hybrids still get every accessory that isn’t on sale.

Then click the duplicate icon on that discount. Its tooltip says “Duplicate discount row”:

The hybrid bike discount in the list, with the pointer on its duplicate icon and the tooltip Duplicate discount row

In the copy, change the condition to Road bikes. Then click Add another exclusion under Customer gets, choose Specific collections, and pick Panniers and Fenders:

Customer gets for road bikes: Bike accessories, excluding on-sale items, and excluding Panniers and Fenders

Your list now has both discounts. The hybrid one says “Cart has any items from Hybrid bikes”, and the road bike one says “excluding on-sale items, 2 collections”. Set the selector above them to Apply maximum. If a customer buys a hybrid and a road bike together, they get the hybrid discount, which already covers every accessory the road bike one does:

Both discounts in one list, set to Apply maximum

Here’s a hybrid’s page. The panniers come first, and the fenders are on the list too:

The FX 2 Stepover Gen 4 product page, listing the Back-Roller panniers and the fenders

And here’s a road bike’s page, with the same accessories apart from the panniers and fenders:

The Tarmac SL7 Sport product page, listing lights, a lock and a saddle bag, without panniers or fenders

Let’s test a cart: a road bike with a pair of panniers and a light. The light gets 15% off. The panniers are charged full price, because the road bike discount no longer covers them:

Cart with the Tarmac SL7 Sport and the panniers at full price, and the light 15% off

And here’s the hybrid cart from the top of this post. The bike is at full price, and the panniers, the fenders and the light are each 15% off:

Cart with the FX 2 Stepover Gen 4 at full price, and the panniers, fenders and light each 15% off

How this compares to an upsell app

Our bike shop merchant came to us from an upsell app. Here’s where Discount Bot’s product page widget does better than the upsell apps our merchants have had trouble with:

  • You set the offer up once. The widget takes its list and its prices from the discount, so changing the discount changes the widget too. With those upsell apps, you pick the products inside the app, separately from the discount, and have to remember to change both.
  • It lists whole collections. Add a product to the collection, and it shows up on the page. Different bikes can list different collections, like the two discounts above. Those apps have you pick products one at a time.
  • There’s no cap. The widget lists everything the discount covers, and the list scrolls. One upsell app our merchants use stops at five items.
  • Free gifts are your real products. Our widget adds the actual product instead of the hidden $0 copy some apps add, and the discount makes it free, like the U-lock in the next section.

Already using an upsell app? Discount Bot works alongside it. Keep only one app’s add-ons on any product page, though: when two apps add items with the same Add to cart button, Shopify can drop one app’s items.

Fit this bike-and-accessories promotion to your store

Our merchants have found these two variations very useful. Here’s each of them, built on the same bike store.

A free U-lock with every bike

A furniture store asked us for a free bedding bundle with every mattress, so three mattresses get three bundles. Let’s say we wanted something like that for our bike shop: a free U-lock with every bike.

Create a new automatic Super discount and add a product discount. Give it one condition with Hybrid bikes and Road bikes, and set Minimum requirements to Minimum quantity of items, 1:

A condition on Hybrid bikes and Road bikes, with a minimum quantity of 1 item

The minimum of 1 matters here. With it, the discount counts the bikes and gives one free lock for each. With no minimum, it only checks that there’s a bike, and every U-lock in the cart is free.

Then choose Different items (Buy X Get Y). Under Customer gets, choose Specific products and pick the 402 U-Lock. Leave How the discount applies on As a repeating offer, with a Customer gets quantity of 1, and set the discount to 100%:

Customer gets: the 402 U-Lock, As a repeating offer, quantity 1

The discount in the list says “1 from 402 U-Lock free per offer” and “Cart has 1+ item from 2 collections”:

The discount in the list: 1 from 402 U-Lock free per offer, Cart has 1+ item from 2 collections

On a bike’s page, the lock shows as Free:

The A free U-lock with every bike section, with the 402 U-Lock marked Free

Let’s test it with two bikes and three locks. Two locks are free, one for each bike, and the third one is $54.99:

Cart with two bikes, one U-lock at $54.99 and two U-locks free

Spend $2,000 on bikes, get 15% off everything else

The same furniture store asked for this one: spend $2,000 on a mattress, and get 15% off everything else in the cart. A similar setup for our bike store would be $2,000 on bikes.

Create another automatic Super discount with a product discount. Give it one condition with Hybrid bikes and Road bikes, and set Minimum requirements to Minimum purchase amount ($), $2,000:

A condition on Hybrid bikes and Road bikes, with a minimum purchase amount of $2,000

Choose Different items (Buy X Get Y). Under Customer gets, leave Any items, and add an exclusion for Hybrid bikes and Road bikes. That’s “everything else”, with no extra collection to keep up to date. Choose To all matching items and set the discount to 15%:

Customer gets: Any items, excluding Hybrid bikes and Road bikes

The discount in the list says “15% off all matching items (excluding 2 collections)” and “Cart has $2000+ from 2 collections”. It also says “Can’t be shown in the product page widget”:

The discount in the list, with the line Can't be shown in the product page widget

This discount still works in the cart and at checkout. It just can’t be listed in the product page widget, because “everything else” is every item in your store. If you’d like it on your bike pages, pick the collections you want listed under Customer gets instead of Any items. The section’s title is the discount’s name, so a name like ours tells customers about the $2,000.

Here’s a cart with a $3,799.99 road bike, a helmet, water bottles and a mirror. The bike is over $2,000, so everything else is 15% off:

Cart with the Tarmac SL7 Sport at full price, and the helmet, bottles and mirror each 15% off

And a $979.99 hybrid with the same helmet. The bike is under $2,000, so the helmet is charged full price:

Cart with the FX 2 Stepover Gen 4 and the helmet, both at full price

If you’d like bigger orders to save more, add a second discount to the same Super discount, at $4,000 and 20% off, and set the selector above the list to Apply maximum. A customer who qualifies for both gets the bigger one.

Build it on your store

Every discount above runs inside Shopify Functions, the same checkout technology Shopify’s own discounts use, with no cloned or hidden products behind it. The product page widget is a block you add in your theme editor. It never edits your theme’s code, and you can turn it off anytime to remove it cleanly.

Since you’ve read this far, you might also be interested in a few other promotions our merchants have found very useful:

Install Discount Bot from the app store and build your perfect promotion. It’s rated 4.8 stars by merchants on the Shopify App Store.

    Share:
    Back to Blog

    Related Posts

    View All Posts »