Market basket analysis is a data mining technique that gives retailers insight into customer preferences by analyzing their shopping and purchasing patterns through data collected at the company’s cash register or website checkout page.
By discovering what goods customers often buy together, businesses can make informed decisions about product selections and placement, advertising campaigns, sales and promotions, discounts, and inventory management.
In this article, you will get a breakdown of the basics in market basket analysis, including the different types of analysis available, and an overview of how you can develop your own market basket analysis.
What is market basket analysis?
Market basket analysis is a methodology used to identify relationships between products, particularly those that are frequently purchased together. It aggregates data to identify items purchased in the same transaction with a strong statistical link.
The concept originated in the traditional retail industry, where grocers used it to design store layouts and product placement. In a physical retail setting, for example, if market basket analysis shows that customers who buy pasta also buy tomato sauce, then it makes sense to place those items near each other.
In ecommerce, this logic powers “frequently bought together” prompts on shopping sites and personalized cross-sell emails. Algorithms identify and highlight complementary products, such as suggesting a specific charging cable the moment a customer adds a tablet to their cart.
In market basket analysis, this is referred to as association rule mining, which uses data sets from your transaction database to create a series of “if-then” statements known as association rules.
For example, the statement: “If a customer buys a digital camera, then there is an 80% chance they will buy a memory card” is an association rule. This data analysis helps brands move beyond guessing by using machine learning tools to quantify and predict consumer behavior.
When you uncover purchase patterns, you can use that information to refine your cross-selling and upselling efforts. Instead of showing customers random products, you can customize what gets displayed based on actual customer buying habits.
The Apriori algorithm is an itemset mining tool that identifies items frequently bought together in a large transactional database. For Shopify users, this logic is natively integrated into the Shopify Search & Discovery app to power recommendations.
How market basket analysis works
Machine learning algorithms handle the heavy lifting of market basket analysis, guided by three primary association rules:
-
Support. This is a statistic measuring how often an item appears in your transactional data. Analysts set a minimum support threshold to filter out patterns that don’t happen often enough to be statistically significant.
-
Confidence. This measures the conditional probability that a customer will buy Item B if they purchased Item A. It is calculated by looking at the same transaction data set as support, but it focuses specifically on the subset of orders when Item A is purchased. Analysts set a minimum confidence threshold to ensure the rule is reliable.
-
Lift. Lift value tells you how much more likely a customer is to buy Item B because they bought Item A, compared to how likely they are to buy Item B anyway. A lift value greater than 1 means the items are highly associated; a lift of 1 means they are independent.
Types of market basket analysis
Depending on your goals, you might use different types of basket analysis:
-
Descriptive market basket analysis. This looks at historical customer data to see what has already happened. This version is used for inventory management and product placement strategy.
-
Differential market basket analysis. This compares market basket data across different stores, seasons, or customer segments. It helps you understand why some popular itemsets occur frequently in one region but not another.
-
Predictive market basket analysis. This uses machine learning and predictive analysis to forecast future customer behavior. It’s the engine behind targeted marketing campaigns and dynamic pricing.
How to conduct a market basket analysis
- Analyze transaction data across orders
- Identify common product combinations
- Measure relationships using metrics like support, confidence, and lift
- Use statistical insights to inform recommendations and merchandising
- Test, refine, and monitor
If you’re ready to turn your transaction data into actionable insights, consider taking the following steps to conduct a market basket analysis.
1. Analyze transaction data across orders
If you’re already a Shopify customer, the first step is to pull your transactional data from Shopify Analytics. You need a transactional database that includes order IDs and product stock-keeping units (SKUs). This lets you see exactly which items were part of the same transaction.
For most businesses, Shopify’s online store cart analysis report is a starting point. This report shows which products are most commonly found in the same basket during a specific period.
Large businesses with huge data sets might choose to export this data to a tool like Google BigQuery to perform more complex frequent mining and predictive analysis.
2. Identify common product combinations
Using frequent itemset mining, identify which combinations of products occur frequently. Look for the anchors—the products that most often lead to a second or third item in the basket. Your goal in mining frequent itemsets is to find the deep-rooted relationships between products.
Shopify’s internal machine learning algorithms can identify these frequent patterns automatically in your behavior reports.
3. Measure relationships using metrics like support, confidence, and lift
Once you have your frequent itemsets, apply the math that powers association rule mining. Although Shopify’s Search & Discovery App handles much of this logic behind the scenes to power its recommendation engines, understanding these metrics helps you fine-tune your marketing strategies:
-
Verify the support. Is the product popular enough to justify dedicated analysis?
-
Check the confidence. Is the if-then relationship between two products statistically robust?
- Validate with lift. Does the data prove a genuine positive relationship between the products? You want to confirm that the two items are actively driving interest in each other, rather than just selling well independently.
4. Use insights to inform recommendations and merchandising
Now that you have identified the relationships, it’s time to apply them using Shopify’s tools. This is where market basket analysis work can translate into informed actions in the following ways:
-
Create fixed bundles with Shopify Bundles. If your analysis shows that two items have high confidence values and lift, use the Shopify Bundles app. This tool lets you create multipacks or curated sets, making it easy for customers to buy the desired pair in one click.
-
Optimize recommendations with the Search & Discovery App. Use this free app to manually set complementary products based on your data, or let the app’s AI use purchasing patterns to suggest items frequently bought together on your product pages.
-
Automate with Shopify Flow. With Shopify Flow, you can set up an automated trigger so that if a customer buys Item A but not Item B, they receive an automated email or SMS text message three days later with a personalized offer for Item B. This is an example of a targeted marketing campaign.
5. Test, refine, and monitor
Consumer behavior is not static; it shifts with seasons, trends, and pricing strategies. A market basket analysis example that works during the winter may not apply in July.
Regularly revisit Shopify Analytics to check for new interesting patterns. Are your cross-selling opportunities actually converting? Use A/B testing on your store layouts—the digital “aisles” of your homepage and collection pages—to see which product placement strategy yields the highest average order value (AOV). By constantly refining your association rules, you ensure your store remains oriented to the way your customers actually shop.
Market basket analysis FAQ
Why do brands use market basket analysis?
Brands use market basket analysis to increase sales, optimize inventory management, and improve pricing strategies. By knowing which products customers are more likely to buy together, businesses create more effective cross-selling and upselling campaigns, leading to a higher average order value and better customer retention.
How does market basket analysis work?
Market basket analysis works by using association rule mining to analyze transactional data. By calculating metrics like support, confidence, and lift, it identifies frequent itemsets and frequent patterns in customer behavior. These insights help businesses predict what a customer will want based on what is currently in their basket and provide the customer with suggestions to prompt a larger purchase.
What is an example of market basket analysis?
A classic market basket analysis example in ecommerce is a fitness brand discovering that customers who purchase yoga mats also frequently purchase electrolyte powders. Using this data mining technique, the brand can then create a “Yoga Starter Kit” bundle or set up an automated email to cross-sell the powder to everyone who buys a mat.




