You know your bestsellers and can pull sales by SKU in seconds. Ask a different question, "which products do my customers buy together, and which pairs keep them coming back," and most stores draw a blank. Product affinity analysis answers it from the order history you already have.
Key takeaways
-
Product affinity analysis measures how much more often two products are bought by the same customers than chance would predict.
-
Run it at two levels: the same basket (one transaction) and the same customer across separate orders. The second level is where repeat purchases come from.
-
It is the same idea as market basket analysis. Affinity is the measure; basket analysis is the method that calculates it.
-
Support, confidence and lift do the work. Lift above 1 is a real pull; below 1 means the products repel and may be substitutes.
-
Results should turn into actions: bundles, product page recommendations, a cross-sell email after the first order, and a substitute check before any of them.
What is product affinity analysis?
Product affinity analysis measures how often two products end up with the same customers, in one basket or across a customer's orders, compared with how often that would happen by chance. It tells you which products your customers buy together, and which product combinations are stronger than simple popularity would explain.
The result is a set of association rules, statements like "customers who buy Product A are more likely to also buy Product B." Product affinity is the relationship itself. Affinity analysis is the process of finding it in your transactions and putting a number on it.
The goals are practical: more cross-selling opportunities, bundles customers actually want, and a clearer view of which purchase relationships lead to a second order.
How is product affinity different from market basket analysis?
It is the same idea under two names. Product affinity is the measure of how strongly two products go together; market basket analysis is the method that calculates it from your orders.
The terms "affinity analysis", "association rules" and "market basket analysis" are used interchangeably. Treat them as one data mining technique with the same three key metrics. It started in grocery stores, where the basket is literal. The one distinction worth keeping is the grouping. Classic basket analysis looks at a single order. A full product affinity analysis also looks at the same customer across separate orders, which is the view that matters for retention.
What do support, confidence and lift mean?
Support is how common a pair is. Confidence is how often the second product comes along when the first is bought. Lift is how much more often the pair appears than it would by chance. The support, confidence and lift glossary entry has the formal definitions.
-
Support is the share of all orders that contain both products. High support means the pair is common enough to matter to the business.
-
Confidence is the likelihood that an order with Product A also contains Product B. It is directional: A to B can differ from B to A.
-
Lift compares the pair with chance. Lift above 1 means a real pull between the products. Around 1 means no relationship: they show up together only because both are popular. Below 1 means they repel each other, often because customers buy one instead of the other.
Worked example
An illustration with round numbers, not a benchmark.
A coffee store has 1,000 orders. Coffee beans are in 250 of them, filters in 200, and tea in 100.
| Pair | Orders with both | Support | Confidence | Lift |
|---|---|---|---|---|
| Beans and filters | 100 | 100 ÷ 1,000 = 10% | 100 ÷ 250 = 40% of bean orders | 40% ÷ 20% = 2.0 |
| Beans and tea | 10 | 10 ÷ 1,000 = 1% | 10 ÷ 250 = 4% of bean orders | 4% ÷ 10% = 0.4 |
Filters are in 20% of all orders but in 40% of orders with beans, so an order with beans is twice as likely as the average order to include filters. That is a pull worth acting on.
Tea is in 10% of all orders but only 4% of bean orders. A lift of 0.4 means beans and tea repel: customers tend to pick one drink or the other.

Same-order affinity vs cross-order affinity
Same-order affinity looks at products bought together in one order. Cross-order affinity looks at products the same customer buys across separate orders, in any order.
Same-order affinity is the classic basket view. It drives bundles, "frequently bought together" blocks and checkout add-ons.
Cross-order affinity groups all orders by customer and checks which products tend to sit in the same customer's purchase history. A customer might buy a trial-size serum one month and the full size another month, or dog food in one order and treats in the next. Same-order analysis misses those pairs.
For DTC brands selling things that get used up, such as coffee, pet food, supplements or skincare, cross-order affinity often matters more: it is what a second-order email or a retention flow should be built on.
How do I run a product affinity analysis from my order data?
Export your orders with one row per product line, count how often each pair appears in the same order and with the same customer, then calculate support, confidence and lift. A spreadsheet is enough for a small catalog.
Columns you need: order ID, customer ID or email, order date, product ID or SKU, product name.
Step 1: Clean the data. Remove test orders, refunds and rows without a product, and standardize product names.
Step 2: Build same-order pairs. For each order, list the distinct products and every pair within it. Count how many orders contain each pair, and how many orders contain each product on its own.
Step 3: Calculate the three measures.
-
Support: orders with the pair, divided by total orders.
-
Confidence for A to B: orders with both, divided by orders with A.
-
Lift: confidence for A to B, divided by the share of all orders that contain B.
Step 4: Build cross-order pairs. Group rows by customer instead of by order. List every distinct product each customer has bought, from any order, and count how many customers have each pair. Support becomes the share of customers rather than orders; confidence and lift work the same way with customer counts.
Step 5: Filter, then read. Drop pairs below a minimum support, then sort the rest by lift.
-
High support, lift near 1: common only because both products are popular. Nothing to act on.
-
Moderate support, high lift: usually the most useful finding, a real connection you can build a bundle or data-driven cross-sell recommendations on.
-
Huge lift from a tiny base: a pair seen in five orders is noise. Check support first.
What should I do with the results?
Put the strongest pairs to work in four places, and check for substitutes before any of them.
Product bundles. Pair a main product with the complementary products customers already buy with it, then test the bundle name and price. The guide to product bundles that increase repeat purchases covers which pairs make good bundles.
Product recommendations on product pages. Feed high-lift pairs into the "customers also bought" block instead of generic bestsellers. It is a simple way to raise average order value without a discount.
A cross-sell email after the first order. A few days after delivery, show the product that customers who bought the same item tend to buy too, using your cross-order pairs. It fits naturally into a post-purchase email flow and is one of the simplest ways to earn the second order.
Retention campaigns. For products that get used up, combine cross-order pairs with reorder timing: remind customers when they are likely to run low, and add the companion product to the same message.
Check substitutes first. Pairs with lift below 1 are often products customers buy instead of each other. Do not bundle or cross-sell them together; use them for comparison content instead.

A practical example for a replenishable brand
Picture a coffee brand selling whole bean coffee, pods, a reusable filter and a sample pack.
Same-order affinity shows that customers who buy whole bean coffee often add the reusable filter. That is a bundle and a prompt on the coffee product page.
Cross-order affinity shows that sample pack buyers often also buy a 1 kg bag of one roast in a separate order. That makes the sample pack a candidate gateway product, one that brings customers back for more, and the gateway products guide explains how to confirm it.
The brand can then build a simple flow: an order confirmation, a short email on how to brew the samples, and a reminder featuring the 1 kg bag before the typical reorder window passes.
What software can do product affinity analysis?
Four kinds of tools can do it: spreadsheets, Python or R scripts, your platform's recommendation apps, and dedicated analysis tools such as Affinsy.
-
Spreadsheets suit small catalogs. Pivot tables count pairs and simple formulas give support, confidence and lift.
-
Python or R scripts automate pair counting and filtering across large order files. Apriori and FP-Growth are the standard algorithms, available in open-source libraries.
-
Platform recommendation apps are built to show shoppers related products on the storefront. They suit stores that want on-page product suggestions running quickly rather than a report to analyze.
-
Dedicated analysis tools read your full order history and present the pairs and the measures in one place, for merchants and agencies who want the analysis without building it.
Where Affinsy fits
Affinsy reads a store's order history from a CSV upload, or from orders sent by webhook or API. It finds product pairs bought together in the same order and by the same customer across separate orders, with support, confidence and lift, and shows only pairs above chance. Substitutes, pairs customers tend to buy instead of each other, are listed separately so you can check them before you bundle.
The same order history gives product roles (which products open baskets, which bring customers back, which keep them buying), reorder timing per product and RFM segments. From a pair or a reorder window you can build a customer list, export it and load it into your email tool yourself.
Next steps
-
Export the last year of orders and build the same-order and cross-order pair tables.
-
Filter by support, sort by lift and pick the three strongest pairs.
-
Check each one against your substitutes before you promote it.
-
Test one on-site change, such as a bundle or a product page block, and one email, such as a cross-sell after the first order.
If you would rather have the strongest pairs, the substitutes and the follow-up customer lists worked out from your own orders, the 48-hour analysis delivers them.
FAQ
How much order data do I need for product affinity analysis?
A few hundred orders is a reasonable floor for a small catalog; below that, focus on your top sellers, because rare products will not produce reliable rules. A rolling window of several months to a year keeps patterns current.
Should I analyze all orders or only first orders?
Both, because they answer different questions. First orders show which products, and which pairs, earn a second order. All orders inform ongoing bundles and cross-sells. Comparing the two shows which products matter for retention and which only add items to one basket.
How often should I refresh the analysis?
Quarterly for a stable catalog, and sooner when you launch new products, change merchandising or enter a strong season. Seasonal brands often find different pairs in different parts of the year.
What if my top pairs do not match the bundles I already sell?
That is a useful signal: customers may be building their own bundles. Test new bundles and product page blocks that mirror the discovered pairs, and keep the existing bundles running until you can compare attachment and repeat purchases side by side.