How to Use Item Quantity and Basket Analysis in WooCommerce: Step-by-Step Tutorial
Introduction to Item Quantity and Basket Analysis
Understanding what customers buy together and in what quantities is crucial for optimizing your WooCommerce store's performance. Item quantity and basket analysis reveals purchasing patterns that can dramatically improve your revenue through better product placement, bundling strategies, and targeted cross-selling.
In this comprehensive tutorial, you'll learn how to analyze your WooCommerce order data to answer critical business questions: What's the typical basket size in your store? Which products are frequently purchased together? Are there opportunities for product bundles that customers are already creating organically?
Unlike traditional analytics that focus solely on individual product performance, basket analysis examines the relationships between products and the aggregate behavior of your customers. This approach, similar to techniques used in AI-first data analysis pipelines, provides actionable insights that can transform your store's profitability.
Prerequisites and What You'll Need
Before You Begin
To successfully complete this tutorial, you'll need:
- Active WooCommerce Store: A functioning WooCommerce installation with at least 100-200 completed orders for meaningful analysis
- Database Access or Export Plugin: Ability to export order data (we recommend WP All Export or similar)
- Basic CSV Understanding: Familiarity with spreadsheet data and CSV file formats
- MCP Analytics Account: Free access to the item quantity analysis service
Required Data Fields
Your export should include these essential fields:
order_id- Unique identifier for each orderproduct_id- Unique identifier for each productproduct_name- Human-readable product namequantity- Number of items purchasedorder_date- Timestamp of the orderorder_total- Total order value (optional but recommended)
Step 1: Understanding Item Quantity and Basket Analysis Fundamentals
Before diving into the data, it's essential to understand what basket analysis can reveal about your store:
Key Metrics You'll Discover
Average Basket Size
This metric tells you how many items, on average, customers purchase per transaction. A higher basket size often correlates with better customer engagement and higher lifetime value.
Product Affinity
Product affinity measures how often products appear together in the same order. High affinity between two products suggests a natural bundling opportunity.
Basket Size Distribution
Understanding the distribution of basket sizes (how many customers buy 1 item vs. 2 items vs. 5 items) helps you identify customer segments and tailor marketing strategies accordingly.
Why This Analysis Matters
- Revenue Optimization: Identify cross-sell and upsell opportunities that align with natural customer behavior
- Inventory Management: Stock complementary products appropriately based on purchase patterns
- Marketing Strategy: Create targeted campaigns that promote frequently co-purchased items
- User Experience: Improve product recommendations to match actual purchasing behavior
Step 2: Exporting Your WooCommerce Order Data
The quality of your analysis depends entirely on the quality of your data export. Follow these steps to ensure you capture all necessary information:
Method 1: Using WP All Export (Recommended)
- Install WP All Export: Navigate to Plugins → Add New in your WordPress admin panel and search for "WP All Export"
- Create New Export: Go to All Export → New Export
- Select WooCommerce Orders: Choose "WooCommerce Orders" as your export type
- Configure Field Mapping: Add the required fields listed in the prerequisites section
Sample Export Configuration
Export Template:
- Order ID: {order_id}
- Product ID: {line_item_product_id}
- Product Name: {line_item_name}
- Quantity: {line_item_quantity}
- Order Date: {order_date}
- Order Total: {order_total}
- Order Status: {order_status}
Filters:
- Order Status: Completed
- Date Range: Last 12 months (or your preferred timeframe)
Method 2: Direct Database Query
If you have database access, you can export data directly using SQL. This method is faster for large datasets:
SELECT
orders.id AS order_id,
order_items.product_id,
order_items.order_item_name AS product_name,
order_item_meta.meta_value AS quantity,
orders.post_date AS order_date,
order_total.meta_value AS order_total
FROM wp_posts AS orders
INNER JOIN wp_woocommerce_order_items AS order_items
ON orders.id = order_items.order_id
INNER JOIN wp_woocommerce_order_itemmeta AS order_item_meta
ON order_items.order_item_id = order_item_meta.order_item_id
LEFT JOIN wp_postmeta AS order_total
ON orders.id = order_total.post_id
AND order_total.meta_key = '_order_total'
WHERE orders.post_type = 'shop_order'
AND orders.post_status = 'wc-completed'
AND order_item_meta.meta_key = '_qty'
ORDER BY orders.post_date DESC;
Data Validation Checklist
Before proceeding, verify your export:
- ✓ No missing order IDs
- ✓ Product names are readable (not just IDs)
- ✓ Quantities are numeric and positive
- ✓ Dates are in consistent format (YYYY-MM-DD recommended)
- ✓ File is saved as CSV with UTF-8 encoding
Expected Output
Your CSV file should look like this:
order_id,product_id,product_name,quantity,order_date,order_total
1001,234,"Organic Coffee Beans",2,2024-01-15,45.99
1001,567,"French Press",1,2024-01-15,45.99
1002,234,"Organic Coffee Beans",1,2024-01-16,28.50
1002,890,"Coffee Grinder",1,2024-01-16,28.50
1003,567,"French Press",1,2024-01-16,19.99
Step 3: Uploading and Running the Analysis
Now that you have your data properly formatted, it's time to analyze it using the MCP Analytics platform:
Upload Your Data
- Navigate to the WooCommerce Item Quantity Analysis tool
- Click "Upload Data" or drag and drop your CSV file
- Verify that the column mapping is correct (the system will auto-detect most fields)
- Confirm that your data preview looks accurate
Configure Analysis Parameters
The analysis engine offers several configuration options to tailor the results to your needs:
Time Period Settings
- Full Dataset: Analyze all available data for comprehensive patterns
- Recent Behavior: Focus on last 3-6 months for current trends
- Seasonal Analysis: Compare specific periods (e.g., Q4 vs Q1)
Threshold Settings
Minimum Support Threshold: 0.01
(Products must appear in at least 1% of orders)
Minimum Confidence Threshold: 0.20
(Co-occurrence must happen in at least 20% of cases)
Maximum Basket Size: 10
(Filter out unusually large bulk orders if needed)
Run the Analysis
Click "Analyze" to process your data. Depending on the size of your dataset, this may take 30 seconds to a few minutes. The system will generate multiple visualizations and statistical reports.
What's Happening Behind the Scenes
The analysis engine applies advanced techniques similar to those described in ensemble learning methods to identify patterns:
- Association rule mining to find product relationships
- Frequency analysis for basket size distribution
- Confidence and lift calculations for product affinity
- Time-series analysis for trend identification
Step 4: Interpreting Your Results
Once the analysis completes, you'll receive a comprehensive report with multiple sections. Here's how to interpret each component:
Basket Size Distribution
This chart shows how many items customers typically purchase per order:
Example Output:
Basket Size | Percentage of Orders | Cumulative %
1 item | 35% | 35%
2 items | 28% | 63%
3 items | 18% | 81%
4 items | 10% | 91%
5+ items | 9% | 100%
Average Basket Size: 2.4 items
Median Basket Size: 2 items
Key Insights:
- If 35% of orders contain only 1 item, there's significant opportunity to increase basket size
- The gap between average (2.4) and median (2) suggests some customers make large purchases that skew the average
- Focus marketing efforts on moving single-item purchasers to the 2-3 item range
Product Affinity Matrix
This section reveals which products are frequently purchased together:
Example Output:
Product A | Product B | Co-occurrence | Confidence | Lift
Organic Coffee Beans | French Press | 15% | 45% | 3.2
Organic Coffee Beans | Coffee Grinder | 12% | 36% | 2.8
French Press | Coffee Filters | 8% | 28% | 2.1
Yoga Mat | Yoga Blocks | 22% | 65% | 4.5
Understanding the Metrics:
- Co-occurrence: Percentage of all orders containing both products
- Confidence: When Product A is purchased, what percentage of times is Product B also purchased?
- Lift: How much more likely are these products to be purchased together vs. independently? (Lift > 1 indicates positive correlation)
Actionable Insights:
In the example above, customers who buy "Organic Coffee Beans" purchase a "French Press" 45% of the time. This is a strong signal to:
- Create a "Coffee Starter Bundle" with both products
- Display French Press as a recommended product on the Coffee Beans page
- Offer a discount when both items are added to cart
Quantity Patterns
Understanding how many units of each product customers buy helps with inventory and pricing:
Example Output:
Product Name | Avg Qty/Order | Most Common Qty | % Buying Multiple
Organic Coffee Beans | 2.1 | 2 | 65%
French Press | 1.0 | 1 | 5%
Coffee Filters (50pk) | 1.8 | 2 | 55%
Strategic Applications:
- Products with high "Avg Qty/Order" are good candidates for volume discounts
- Items always purchased singly (like French Press) might benefit from "Frequently Bought Together" suggestions
- Consider packaging options (e.g., 2-pack) for items where 65% buy multiples
Temporal Patterns
The analysis also reveals how basket behavior changes over time, helping you identify seasonal trends and the impact of marketing campaigns.
Step 5: Applying Insights to Optimize Your Store
Analysis is only valuable when you take action. Here's how to implement your findings:
1. Create Product Bundles
Based on high-affinity product pairs, create curated bundles:
// Example: WooCommerce product bundle setup
1. Install "WooCommerce Product Bundles" plugin
2. Create new product: "Coffee Enthusiast Starter Kit"
3. Add components:
- Organic Coffee Beans (Qty: 2)
- French Press (Qty: 1)
- Coffee Grinder (Qty: 1)
4. Set bundle price: $89 (vs $105 individual = 15% savings)
5. Configure bundle discount: "Save $16 when purchased together"
2. Optimize Product Recommendations
Update your "Related Products" and "You May Also Like" sections based on actual affinity data rather than categories alone:
// Example: Custom recommendation logic
Product Page: Organic Coffee Beans
Recommended Products (by affinity score):
1. French Press (Lift: 3.2) - "45% of customers also bought this"
2. Coffee Grinder (Lift: 2.8) - "Perfect companion for fresh beans"
3. Coffee Filters (Lift: 2.1) - "Complete your coffee setup"
3. Implement Dynamic Discounting
Encourage basket growth with smart discount rules:
- Threshold Discounts: "Add one more item for 10% off" (targeting customers at 1-2 items)
- Bundle Incentives: "Frequently bought together - Save 15%"
- Quantity Breaks: For products with high multi-unit purchase rates
4. Refine Email Marketing
Use affinity data to create targeted email campaigns:
Email Template:
"We noticed you recently purchased our Organic Coffee Beans. Did you know that 45% of our customers also enjoy brewing with our French Press? Here's an exclusive 20% discount to complete your coffee experience..."
5. Inventory Optimization
Stock complementary products proportionally:
If Coffee Beans and French Press have 45% co-occurrence:
- For every 100 bags of coffee beans ordered
- Plan to stock ~45 French Presses
- Adjust based on existing French Press standalone sales
Measuring Success
After implementing changes, track these metrics:
- Average basket size (target: 10-15% increase)
- Average order value (target: proportional to basket size increase)
- Bundle conversion rate (target: >5% of total orders)
- Cross-sell acceptance rate (target: >15% click-through on recommendations)
Re-run your analysis monthly to track improvements and identify new opportunities. Consider using A/B testing methodologies to validate the impact of specific changes.
Ready to Discover Your Store's Hidden Patterns?
You've learned the fundamentals of item quantity and basket analysis, but the real insights are waiting in your own data. Don't leave revenue on the table by guessing what your customers want—let the data guide your decisions.
Start Your Free Analysis Today
Upload your WooCommerce order data to the MCP Analytics platform and discover:
- Which products are purchased together most frequently
- Optimal bundle combinations for maximum revenue
- Customer segments based on basket behavior
- Seasonal trends and purchasing patterns
The analysis takes less than 5 minutes to set up, and you'll have actionable insights within minutes. Join hundreds of WooCommerce store owners who have increased their average order value by 15-30% using data-driven basket optimization.
Next Steps and Advanced Techniques
Expand Your Analysis
Once you've mastered basic basket analysis, consider these advanced approaches:
1. Customer Segmentation
Analyze basket patterns by customer segment (new vs. returning, high-value vs. low-value) to create personalized experiences.
2. Temporal Analysis
Examine how basket composition changes by day of week, season, or in response to marketing campaigns.
3. Sequential Pattern Mining
Go beyond single-order analysis to understand the sequence of purchases across multiple orders (what do customers buy on their second order after buying Product X first?)
4. Price Sensitivity Analysis
Combine basket analysis with pricing data to understand how discounts affect product combinations and basket size.
Related Resources
- WooCommerce Item Quantity Analysis Service - Full service documentation
- Advanced Statistical Methods for E-commerce - Take your analysis deeper
- WooCommerce Customer Lifetime Value Analysis - Understand long-term value (coming soon)
Join the Community
Connect with other data-driven store owners, share insights, and learn advanced techniques in the MCP Analytics community forum.
Troubleshooting Common Issues
Problem: "No significant product affinities found"
Cause: Dataset too small or highly fragmented product catalog
Solutions:
- Increase date range to include more orders (aim for 200+ completed orders minimum)
- Lower the minimum support threshold from 0.01 to 0.005
- Group similar products (e.g., different coffee bean varieties) into categories for analysis
- Filter out one-time or seasonal products that create noise
Problem: "Export file too large to upload"
Cause: Dataset exceeds platform limits (typically 50MB)
Solutions:
- Analyze data in date ranges (e.g., quarter by quarter)
- Remove unnecessary columns (keep only required fields)
- Filter to completed orders only in your export
- Compress CSV file using ZIP before upload
Problem: "Inconsistent or missing product names"
Cause: Product variations or database encoding issues
Solutions:
// Clean data before upload using spreadsheet formulas
1. Remove special characters: =SUBSTITUTE(A2,CHAR(160)," ")
2. Standardize case: =PROPER(A2)
3. Remove leading/trailing spaces: =TRIM(A2)
4. Consolidate variations: Find/Replace "Coffee - Organic" → "Organic Coffee"
Problem: "Lift scores seem incorrect or counterintuitive"
Cause: Misunderstanding of lift calculation or insufficient sample size
Understanding:
- Lift = 1.0 means products appear together at expected random rate
- Lift > 1.0 means positive correlation (good for bundling)
- Lift < 1.0 means negative correlation (products rarely purchased together)
- Very high lift (>10) with low co-occurrence often indicates insufficient data
Problem: "Analysis results change dramatically between runs"
Cause: Small sample size or highly volatile purchasing patterns
Solutions:
- Use longer time periods for more stable patterns
- Implement rolling averages (compare 90-day windows)
- Focus on high-confidence patterns (>30% confidence, >2.0 lift)
- Consider seasonality—compare same periods year-over-year
Problem: "Can't connect export plugin to database"
Cause: Database permissions or hosting restrictions
Solutions:
- Contact hosting provider to verify database access permissions
- Use phpMyAdmin (available in most cPanel installations) for direct export
- Try alternative export plugins: WP All Export, Advanced Order Export
- Use WooCommerce → Reports → Export CSV (limited fields but works universally)
Getting Additional Help
If you encounter issues not covered here:
- Check the full service documentation
- Contact MCP Analytics support with your error message and sample data
- Join the community forum to ask questions and see solutions from other users
Explore more: WooCommerce Analytics — all tools, tutorials, and guides →