- Two products appearing in the same order proves nothing. Your best seller appears in most orders, so it pairs with everything.
- Lift is the metric that fixes this. It divides how often the pair happens by how often chance says it should. Below 1 there is no relationship worth acting on.
- A small catalogue needs surprisingly few orders to find a pairing, but needs the pairing to be frequent. Roughly 300 orders with the pair in at least 20 of them is the floor for a number you can trust.
- A discovered pairing is not automatically a discounted bundle. If the discount costs more than the added unit earns, the bundle destroys margin while looking like growth.
- Cannibalisation is the trap. If both items would have sold separately anyway, a bundle discount is a voluntary price cut.
- In the EU a pre ticked add on is refundable by law, whatever the data says. Consent has to be active.
Somewhere in your order history are pairs of products that genuinely belong together, and a much larger number of pairs that merely happened. Telling them apart is a solved problem with a forty year old answer, and the reason it still goes wrong in small shops is that the tools report the easy metric instead of the useful one.
This is a piece about doing the analysis honestly on a catalogue of a few hundred products and a few thousand orders, which is a very different situation from the supermarket scale the textbooks assume.
Why does the obvious method recommend your best seller to everyone?
Because the obvious method measures popularity and calls it affinity. If you sell one item that appears in 60% of orders, it will co occur with almost everything else in your catalogue, and any rule ranked by raw co occurrence or by confidence will surface it again and again.
The vocabulary here is worth learning because it is what every tool reports. Support is how often an itemset appears across all transactions. Confidence, per the definition in the mlxtend association rules documentation, is the probability of seeing the consequent in a transaction given that it contains the antecedent. Both are useful and neither controls for popularity.
Lift does. The same documentation describes it as measuring how much more often two things occur together than expected if they were statistically independent, with a score of exactly 1 when they are independent. The formula is visible in the library's own source, where lift is simply confidence divided by the support of the consequent, which is the division by chance that confidence forgets to do.
Put a number on it. If a candle appears in 40% of your orders and a matchbook appears in 10%, chance alone puts them in 4% of orders together. If they actually co occur in 4.2% of orders, the lift is about 1.05 and there is no relationship. If they co occur in 9% of orders, the lift is 2.25 and you have found something.
| Metric | What it literally measures | What it answers for a merchant | Where it misleads |
|---|---|---|---|
| Support | Share of all orders containing the itemset | Is this pairing frequent enough to bother with | Says nothing about whether the pairing is meaningful |
| Confidence | Probability of item B given item A | If someone buys A, how often do they take B | Ranks your best seller top against every antecedent |
| Lift | Observed co occurrence divided by expected under independence | Is this pairing stronger than coincidence | A huge lift on four orders is noise, not a finding |
| Leverage | Observed minus expected frequency, on an absolute scale | How many extra orders the relationship is actually worth | Small for rare pairs even when the relationship is strong |
| Conviction | How much the rule would break if the items were independent | How dependable the rule is when it fires | Goes to infinity on perfect rules, which is usually a data bug |
Leverage deserves more attention than it gets from small merchants, because it is the one denominated in orders rather than in ratios. A lift of 8 on a pair that appears in six baskets a year is a curiosity. A lift of 1.6 on a pair in four hundred baskets is a merchandising decision.
How many orders do you need before the number means anything?
Enough that the pair itself is common, not just the catalogue. The sample size that matters is not your total order count but the count of orders containing both items, and below roughly twenty such orders the lift score swings wildly on one or two purchases.
A practical floor for a small shop looks like this. Around 300 completed orders in the window you are analysing, at least 20 of them containing the pair, and a window short enough that the catalogue and the pricing did not change much inside it. Three months is usually right. A year of data across two price changes and a seasonal range is not one population, and the rules you mine from it describe a shop that no longer exists.
The methods themselves scale down fine. Association rule mining was popularised by a 1993 paper from Agrawal and colleagues, with the Apriori algorithm following in 1994, and they were designed for point of sale data at a size that makes any modern shop look tiny. Nothing in the maths requires scale. What requires scale is confidence in a rare rule.
Which brings up the story everyone quotes. The beer and nappies finding is usually retold as proof that data mining reveals hidden gold. The actual account, recorded on the same page, is that an analysis of 1.2 million market baskets from about 25 Osco Drug stores in 1992 surfaced the association during particular evening hours, and the managers never exploited the relationship commercially. It is a better cautionary tale than a success story: a real correlation, at enormous scale, that nobody could turn into money.
Does a real pairing mean you should discount the bundle?
No, and this is where most bundling money is lost. A pairing tells you the two items belong near each other. Whether the second unit is worth buying with a discount is a margin question that no rule mining library computes.
The arithmetic is short. Take the extra gross margin you earn when the second item sells, then take the total discount you give away on the bundle across every customer who buys it. If the discount is applied to customers who would have bought both anyway, you are paying them to do what they already did. The bundle only earns its keep if the share of customers it converts from one item to two is large enough to cover the discount given to the customers it did not convert.
Write it as a rule. If C is the share of bundle buyers who would otherwise have bought only one item, M is the gross margin on the added item and D is the discount per bundle, the bundle makes money when C multiplied by M exceeds D. With a 30% margin on a twenty pound add on, that is six pounds of margin, so a five pound bundle discount needs more than 83% of bundle buyers to be genuine conversions. That is almost never true for two items that already co occur strongly, which is the uncomfortable paradox at the centre of bundling: the strongest statistical pairings are the worst discount candidates, because those customers were already buying both.
The resolution is to split the response. Strong pairing with high existing co purchase becomes a recommendation, placed on the product page and in the cart, at full price. Moderate pairing where one item clearly leads the other becomes the discounted bundle, because there is a real conversion to buy. We went through the related version of this problem, deciding what to show when you barely have history, in the piece on product recommendations for a shop with almost no data.
What does the law say about the add on at checkout?
It says consent must be active, and a default that the customer has to untick is not consent. In the EU, Article 22 of the Consumer Rights Directive is unusually blunt about it, and the consequence is refund rather than a fine.
The text is worth reading once in full, because merchants routinely get the second sentence wrong. Article 22 requires the trader to seek express consent to any extra payment beyond the main contractual obligation, and states that where consent was inferred from default options the consumer is required to reject, the consumer is entitled to reimbursement of that payment.
Read plainly, that means a pre ticked gift wrap box, a pre selected extended warranty or an automatically added bundle upgrade is not merely bad manners. The customer can have the money back. No lift score changes that, and no personalisation engine is a defence.
The distinction that matters is between a price and an extra payment. Offering a bundle at a single combined price, clearly labelled, with the components listed, is a product. Adding an item to a basket the customer assembled, and charging for it unless they notice, is the thing Article 22 makes refundable. Design the bundle as a product and the question does not arise.
What actually breaks when a small shop bundles
Three failures show up repeatedly, and none of them are statistical.
The first is stock. A bundle couples the availability of two items, so the bundle goes out of stock when either component does. If one component is a slow mover you were trying to clear, the bundle now holds your fast mover hostage to it. Bundles built to shift dead stock tend to convert the wrong way, cutting sales of the healthy product rather than lifting the dying one.
The second is fulfilment. Two items that ship in different boxes, or that fall in different delivery classes, turn one order into two shipments and quietly eat the margin the bundle was supposed to create. Check the packed weight and the dimensional bracket before you publish the offer, not after the first hundred orders.
The third is returns. A bundle returned partially is an accounting problem most small shops have never specified. If a customer keeps the candle and returns the matchbook, does the candle revert to full price? Decide before you launch and put the answer in the policy, because the alternative is deciding it differently every time under pressure.
None of these appear in an association rules table. They are the reason a data driven bundle can show a healthy lift score and still lose money for six months.
Can you do this without writing code?
Yes, and for a small catalogue a spreadsheet is genuinely adequate. Export your order lines, build a pivot of orders by product, and for each candidate pair compute three numbers: how many orders contain both, how many contain each separately, and the total order count. Lift is the first divided by the product of the other two shares. Most shops find their five real pairings in an afternoon.
The value of a library appears when the catalogue is large enough that checking every pair by hand is impractical, which in practice means a few hundred products upward. Even then the output is a candidate list, not a decision. Every rule still has to pass the margin test and the operational tests above before it becomes an offer.
And be careful about letting a model write the bundle copy off the back of the rule. A pairing found in basket data says customers bought both. It does not say the items work together, fit together or are safe together, and an assistant asked to explain the bundle will happily invent a reason. The same failure mode we described in writing product descriptions with AI without sounding like AI applies with more force here, because a false compatibility claim is a returns problem rather than a style problem.
What if you have no basket data yet?
Then you borrow structure instead of mining it. A shop six weeks old has no reliable pairings, and waiting for three hundred orders is the correct answer for the statistics but a poor answer for the business.
Three substitutes work reasonably well in the meantime. The first is consumption logic: an item that is used up pairs with the item it is used with, and that relationship holds across shops because it comes from the product rather than from your customers. The second is your supplier's own data, since a wholesaler who sells the same two lines to fifty retailers usually knows which move together and will tell you if asked. The third is your returns and support inbox, where a customer writing to ask whether something fits something else has handed you a pairing hypothesis for free.
Treat all three as guesses to be tested rather than as findings. Publish the pairing as a recommendation at full price, tag the orders that take it, and you have built the very dataset you were missing. Within a quarter the guesses either show up in the basket analysis or they quietly do not, and both outcomes are informative. What you should not do is run association rules on ninety orders and act on a lift of 6 that rests on four baskets, because that number will reverse itself the moment a single customer changes habit.
A short method you can run this month
Pull ninety days of order lines. Drop the orders containing only one item, since they carry no pairing information and they dilute your support figures. Compute lift for every pair that appears in at least twenty orders. Sort by leverage rather than by lift, because leverage tells you the size of the prize in orders.
Take the top five. For each, ask whether the pairing has a reason a customer would recognise, since a pairing you cannot explain is usually a seasonal artefact or a single wholesale buyer. Then apply the margin rule and decide, one by one, whether each becomes a recommendation at full price or a discounted bundle.
Publish two of them, not five. Measure attach rate on those two for a month against the same period before, and look at gross margin per order rather than average order value, because average order value rises whenever you bundle and tells you nothing about whether you made money. Pricing discipline is the same discipline either way, and we set out the boundaries of it in the piece on dynamic pricing for a small shop.
If your storefront cannot express a bundle as a real product with its own stock behaviour and its own returns rule, that is a platform limitation rather than an analysis problem, and it is worth knowing before you start. A shop whose code you can change treats a bundle as a first class item rather than a discount code with good intentions, which is one of the practical arguments for owning the storefront you sell from.
The discipline in all of this is refusing to be impressed by a correlation. Your order history contains thousands of pairs and a handful of relationships, and the gap between those two numbers is where bundling strategies go to die. Find the handful, check the margin, ask for consent properly, and leave the rest of the table alone.