Product Affinity: How to Run a Product Affinity Analysis for Cross-Sells

Discover how product affinity data reveals consumer shopping behaviors and strategies to turn first-time buyers into loyal, repeat customers across different brands.

Alex JostAlex Jost
Founder of RetentionX · Jun 10, 2025 · 9-minute read

On a sunny Saturday afternoon, Hannah strolls into her kitchen, pours herself a refreshing iced coffee, and checks her phone for weather updates. She's thrilled to see a string of 85-degree days in the forecast - perfect for a quick trip to the beach. As she mentally plans her trip, one thing becomes clear: "I need a new swimsuit!"

Key takeaways
1
Product affinity analysis finds which products customers buy together or next: if a customer buys X, how likely are they to buy Y?
2
Three numbers do the work: support (how common the pair is), confidence (share of X buyers who also buy Y) and lift (confidence ÷ Y’s baseline rate).
3
Worked example: 25% of swimsuit buyers later buy the cover-up vs. a 12% baseline, a lift of about 2.1. Above 1 means a real link.
4
For a DTC brand, look at next-order affinity as well as same-basket pairs: what customers buy in order 2 and 3.
5
Pair the "what" with the "when": in the swimsuit example the gap to the next order shrinks from 90 days after order 1 to 30 days after order 5.
In this post
01Mastering product affinity analysis→
02Support, confidence and lift→
03How to run it in Shopify→
04Turning insights into action→
05Nailing the timing of your offers→
06FAQ→
Part 1 · The story

The Shopper’s Fork in the Road

At this juncture, Hannah can take one of two routes:

  1. Shop with a brand she’s bought from before (Brand A). – Let’s say about 35% of buyers do this when making a new purchase.

  2. Explore the sea of new brands (Brand B). – Roughly 65% venture off to see what else is out there.

Sound familiar? We’ve all been Hannah, toggling between brand loyalty and the allure of something fresh.

Business Reality Check: Winning (and Keeping) Customers

Now let’s shift to your perspective as Brand A. You’ve poured resources into winning Hannah’s business the first time around—targeted ads, stunning lookbooks, maybe even a promo code. Yet here she is, barely a few months later, poised to look elsewhere. Did you really do anything wrong?

Probably not. But you may have overlooked opportunities to keep Hannah engaged—enticing her to come back for that next purchase. That’s where a data-powered retention strategy can make all the difference, especially through product affinity analysis.

Mastering Product Affinity Analysis

Let's consider the example of a typical grocery store. There are a variety of products we assume people will often purchase together at a grocery store: ice cream and waffle cones, peanut butter and jelly, turkey and cream cheese. By performing an affinity analysis on the grocery store’s data set, we can not only confirm our suspicions about which products are frequently purchased together, but also discover new relationships between products and customers that we never would have guessed.

These relationships between products and customers are also known as association rules. After running an affinity analysis, rules are produced in the following form:

{waffle cones} ⟹ {ice cream}

{flour, sugar} ⟹ {eggs}

In other words, if a customer buys Product X, there’s a certain probability they’ll also purchase Product Y—maybe in the same transaction, maybe later on.

Now let's apply this logic to your fashion brand:

Two key metrics come up often:

  • Support: The percentage of orders in which a specific product or combination shows up.

  • Confidence: Given the “left” product(s), the likelihood that buyers will also pick up the “right” product(s).

High support means a product pairing or combo appears a lot in your orders. High confidence indicates that if customers buy the first item, they frequently buy the second.

Part 2 · The guide

Product affinity metrics: support, confidence and lift

Support and confidence tell you how common a pairing is. They don't tell you whether buying X actually makes Y more likely, because a bestseller shows up next to everything. That is what lift is for: it compares confidence with how often customers buy Y anyway.

Product affinity metrics
Swimsuit buyers are about 2.1× as likely to buy the cover-up.
Worked example: 10,000 customers, 2,000 bought a swimsuit, 1,200 bought a cover-up, 500 bought a swimsuit and then a cover-up.
MetricHow to calculateExample
SupportCustomers who bought X then Y ÷ all customers500 ÷ 10,000 = 5%
ConfidenceCustomers who bought X then Y ÷ customers who bought X500 ÷ 2,000 = 25%
Baseline rate of YCustomers who bought Y ÷ all customers1,200 ÷ 10,000 = 12%
LiftConfidence ÷ baseline rate of Y25% ÷ 12% ≈ 2.1
Illustrative numbers. Rank pairs by lift, then check support.

How to read it: a lift above 1 means X buyers pick up Y more often than everyone else; around 1 means there is no real link; below 1 means the products tend to replace each other, a sign of product cannibalization. Rank pairs by lift, then check support so you don't build a campaign on a handful of orders.

Part 3 · Do it yourself

How to run a product affinity analysis in Shopify

You can get a first version out of a Shopify order export and a spreadsheet:

In Shopify · 6 steps
1
Export your orders
Orders → Export, all orders as CSV with customer email, order date and line items (Lineitem name or sku). Drop cancelled, refunded and $0 orders.
2
Decide what "together" means
Same-basket = items in the same order. Next-order = what the same customer bought in their next order, usually the more useful view for DTC.
3
Work at the right level
Single SKUs are often too thin: group variants into products or categories (swimsuits, cover-ups, towels).
4
Count three things per pair
For every X → Y: customers who bought X, who bought Y, and who bought X and then Y. Calculate support, confidence and lift as in the chart above.
5
Filter and sort
Keep pairs with a minimum count (e.g. 50+ customers who bought X and then Y) and sort by lift.
6
Turn top pairs into actions
Post-purchase flow for X buyers without Y, timed to the gap after X (replenishment time); "next logical item" blocks on X's page; bundles where same-basket lift is high; high-lift add-ons to clear your free shipping threshold.

Affinity tells you where customers go next. Product stickiness tells you whether they come back for the same product first, so read the two together. For the offer side of the same idea, see cross-selling and upselling.

Common mistakes

MistakeDo this instead
Ranking by confidence aloneUse lift: a bestseller gets high confidence with almost everything.
Ignoring order sequenceRead both: same-basket pairs point to bundles; next-order pairs show the path from first to third order.
Counting exchanges as next ordersLeave exchanges out: swapping a size is not affinity (why exchanges distort repeat data).
Discounting pairs customers buy anywayWhen lift is already high, send a well-timed reminder instead of a coupon.

Turning Insights into Action

  1. Targeted Email Campaigns: Build a list of customers who bought the left item but never tried the right one, then send them compelling reasons to try the missing piece.

  2. Personalized Website Prompts: Add “People who also bought…” pop-ups or recommendations on product pages.

  3. Bundles & Discounts: If you spot strong complementary products (like beach towels + sunscreen), consider bundling them or offering a discount to boost average order value.

  4. Segment-Specific Loyalty Programs: Differentiate your loyalty tiers based on what people have purchased—and reward them for completing certain “sets” of products.

Nailing the Timing of Your Offers

Knowing which items go together is only half the puzzle. Timing your next touchpoint is equally critical. Too soon, you risk annoying buyers who aren’t ready. Too late, a competitor might snatch them first.

Let’s say you have three customers:

Time to next order
Same affinity rule, three different send dates.
All three bought Product A but never Product B. Typical time to repurchase from the swimsuit chart in this section.
Customer IDLifetime ordersTypical time to next order
Lisa190 days
Hannah440 days
Jordan270 days
Time each cross-sell to the customer’s order count, not one date for everyone.

All three purchased Product A (maybe a particular swimsuit style) but have never tried Product B (a matching cover-up). Your data suggests a strong affinity rule between those items. Do you email them all at once? Probably not.

  • Examine the average time between orders for customers with 1 lifetime purchase (like Lisa) versus those with 4 (like Hannah). Maybe first-time buyers typically wait five months before purchasing again, while those with multiple orders re-up every two or three months.

  • By sending promotions around the time your data shows they’re likely to shop again—or a touch earlier if you want to shorten the gap—you’ll greatly increase your odds of engagement.

  • The time between purchases is primarily driven by the product/category purchased in the previous purchase (also by quantity for CPG brands) and how many purchases a customer has made with your brand (loyalty).

From Data to Actionable Strategy

By combining affinity analysis (the “what”) with your time-between-orders data (the “when”), you create a powerful one-two punch for bringing people back. Instead of generic blasts, you’re delivering tailored promotions at moments when your customers are actually in buying mode.

The same logic applies across orders, not just within one basket. To see which product first-time buyers actually move to next, and how many days later, map your second purchase pathways.

  1. Experiment: If you see a 90-day lull between purchases, try nudging them at day 70 to see if you can encourage an early reorder.

  2. Upsell/Cross-Sell: Have a sporty swimsuit that often pairs with a rash guard? Send out that recommendation after your data-suggested window.

  3. Segment by Frequency: Casual shoppers may need a longer time to “recover” before buying again, whereas your loyal fans might be ready in just a few weeks.

FAQ: Product affinity

What is product affinity?
Product affinity is how strongly buying one product is linked to buying another, in the same order or a later one. In ecommerce it puts numbers on "customers who bought X also bought Y": how often the pair occurs, what share of X buyers also buy Y, and whether that share is higher than Y's normal purchase rate.
What is product affinity analysis?
Product affinity analysis, also called market basket or association analysis, scans order data for products bought together and expresses them as rules such as {swimsuit} ⟹ {cover-up}. Each rule gets a support, confidence and lift score, which tells you which cross-sells, bundles and recommendations are worth acting on.
How do you calculate lift?
Lift = confidence ÷ the baseline rate of the second product. If 25% of swimsuit buyers later buy a cover-up and 12% of all customers buy a cover-up, lift is 25% ÷ 12% ≈ 2.1. A lift above 1 means the first purchase makes the second more likely; below 1 means the products tend to replace each other.
What is the difference between support and confidence?
Support is the share of all orders or customers that contain the pair, so it shows how big the opportunity is. Confidence is the share of customers who bought the first product and also bought the second, so it shows how strong the link is from that product's side. A rule needs enough of both to be worth a campaign.
How do I find products frequently bought together in Shopify?
Export your orders, group line items by order for same-basket pairs or by customer for next-order pairs, and count how often each pair appears. A spreadsheet pivot works for small catalogs; larger ones need a script. Shopify's built-in recommendations don't show support, confidence or lift for each pair, so the export is where the numbers come from.
TIP
I know that’s a lot to take in! I’ve been in the same position—feeling overwhelmed about where to find the data, how to get started, and how to embed an LTV-driven mindset into my teams. That’s why we built RetentionX. As a brand operator, it has been my #1 internal tool to turn things around before launching it as publicly available software.