Profit
How to calculate gross margin by product in WooCommerce
WooCommerce doesn't show gross margin by product. To calculate it, download Analytics › Products for a date range, add each product's unit cost in a spreadsheet, then work out cost of goods (unit cost × items sold), gross profit (net sales − cost of goods) and gross margin (gross profit ÷ net sales).
The steps below take about 20 minutes the first time and five after that. Then: how to handle variations, how to read the result, and the mistakes that make margins look better or worse than they are.
The free way: Analytics export plus a spreadsheet
You need two things: net sales and units per product from WooCommerce, and a unit cost for each product.
1. Export sales by product
- In WordPress admin, go to Analytics › Products.
- Set the date range, for example Last month or Last quarter. Longer ranges smooth out odd weeks.
- Click Download. Small exports download straight away; large ones are emailed to you.
The CSV includes Product title, SKU, Items sold, Net sales and Orders for each product. Net sales here is after coupons and refunds, excluding tax and shipping.
2. Add unit costs
Put your costs in a second tab: SKU, product name, unit cost. If you use WooCommerce's core Cost of Goods Sold field (10.3 and later), export your products from Products › All Products › Export and the cost column comes with them. Otherwise, use supplier invoices. The guide on adding cost of goods to WooCommerce covers both.
Then pull the cost into the sales tab with a lookup on SKU, for example =XLOOKUP(B2, Costs!A:A, Costs!C:C) in Excel or Google Sheets.
3. Add the margin columns
| Column | Formula |
|---|---|
| Cost of goods | Unit cost × Items sold |
| Gross profit | Net sales − Cost of goods |
| Gross margin | Gross profit ÷ Net sales |
| Share of profit | Gross profit ÷ total gross profit |
Here's what it looks like for a small homeware store in October:
| Product | Items sold | Net sales | Unit cost | Cost of goods | Gross profit | Margin |
|---|---|---|---|---|---|---|
| Stoneware mug | 218 | $2,180 | $3.50 | $763 | $1,417 | 65% |
| Ceramic pour-over set | 81 | $3,240 | $19.00 | $1,539 | $1,701 | 53% |
| Linen napkin set | 54 | $1,620 | $9.00 | $486 | $1,134 | 70% |
| Cast-iron trivet | 120 | $1,800 | $11.50 | $1,380 | $420 | 23% |
The pour-over set earns the most gross profit even though its margin is middling. The trivet sells well but keeps only $3.50 a unit, which shipping a heavy item could easily wipe out.
How to handle variable products
Analytics › Products adds every variation of a product into one row. That's fine if all sizes and colors cost the same. If they don't (a larger size uses more fabric, one color comes from a pricier supplier), use Analytics › Variations instead and match costs at the variation level by SKU.
Watch for variations without their own SKU. Give each one a SKU before you start, or the lookup will fail. There's more on variation reporting in how to see sales by variation.
Why your margins might look wrong
- Discounts are already in net sales. A product that's often bought with a coupon shows lower net sales per unit, so its margin is lower. That's accurate, but it's worth knowing why. See how discounts eat into WooCommerce margins.
- Refunds hit the refund month. Analytics subtracts a refund on the date it's issued. If a product had a big refund this month for last month's orders, this month's net sales can look low next to units sold, and margin dips.
- Refunded units. When a refund includes item quantities, Analytics takes those units off items sold, so their cost drops out of your calculation. That's right if the item came back and was restocked, but it understates cost for refunds where you never got the product back. The guide on profit after refunds and discounts shows how to adjust.
- Old costs. If a supplier raised prices mid-year, a single unit cost for the whole year mixes two realities. Keep a dated cost list.
- Excluded statuses. Orders with a status listed under Analytics › Settings › Excluded statuses aren't counted. Check your settings if units look low.
Reading the result: margin or profit dollars?
Sort the sheet by gross profit, not margin. Margin tells you how much of each sale you keep. Gross profit tells you how much a product actually contributes. A 75% margin product that sells ten units a month matters less than a 40% margin best seller.
Then look at the bottom of the list by margin. For each low-margin product, ask:
- Does its margin still cover shipping and payment fees? If shipping a unit costs more than its gross profit, every sale loses money. The guide on shipping costs vs charges helps here.
- Can the price go up? Low-margin products are often priced years ago.
- Does it bring customers who buy higher-margin products too? If so, it may be worth keeping as it is.
Subtract those variable costs and you have contribution margin by product, which is the truer test.
What Askshelf can and can't tell you
Askshelf can now do this calculation for you. With WooCommerce's Cost of Goods Sold feature on and a cost on each product, ask for profit and it returns net sales, cost of goods, gross profit and margin for each product, plus the store total. It can compare with the previous period too, which shows whether a high-margin product is growing or fading.
It uses the cost recorded on each order when it was placed, so orders from before you entered costs have no profit figure. It also stops at gross profit: shipping costs and payment fees aren't included, so the contribution margin step above is still yours to do.
Which products had the best gross margin in October?
The spreadsheet method still works for periods before you entered costs, because you can apply today's costs to old sales yourself. Askshelf is free for 10 questions a month; the profit reporting use case explains the routine.
What to do with the margins
- Raise prices on low-margin best sellers in small steps and watch units sold for a month.
- Push high-margin products in emails and on the home page.
- Stop discounting products with thin margins. A 20% coupon on a 23% margin product leaves almost nothing.
- Renegotiate or reorder in bulk for products where cost is the problem.
For the full profit picture, including shipping, refunds and fees, read the WooCommerce profit reporting guide.
Common questions
What is a good gross margin for an online store?
It depends heavily on what you sell and how you make it, so there isn't one number to aim for. Compare each product against your own store average and watch the trend over time, and make sure margin covers shipping, fees and marketing.
Should I calculate margin on net sales or gross sales?
On net sales. Net sales has refunds and coupon discounts taken out and excludes tax and shipping, so it's the revenue you actually kept from the product.
Can Askshelf show gross margin by product?
Yes, if Cost of Goods Sold is on and your products have costs. It lists net sales, cost of goods, gross profit and margin per product for any date range. Orders from before costs were entered have no profit figure, and shipping and payment fees aren't included.
What is the difference between margin and markup?
Margin is profit divided by the selling price. Markup is profit divided by cost. A product that costs $10 and sells for $20 has a 50% margin and a 100% markup.
See how Askshelf handles this: Profit reporting for WooCommerce