The COGS Formula Explained With Real Shopify Examples
If you're selling on Shopify, you probably know your revenue number. But do you know your real cost of goods sold?
Here's the problem: most Shopify sellers think COGS is just the price they paid their supplier. It's not. That gap—between what you think COGS is and what it actually is—costs you thousands in wrong pricing decisions, misaligned marketing spend, and false margin claims.
We're going to walk through the formula, then work through three real-world examples: a reseller, a manufacturer, and a dropshipper. By the end, you'll know exactly what to include in your COGS calculation and how to avoid the silent profit leaks that most merchants miss.
The Basic COGS Formula
Let's start with the accounting definition:

COGS = Beginning Inventory + Purchases − Ending Inventory
This tells you how much inventory you consumed (sold) during a period. But for pricing decisions and margin analysis, most Shopify sellers need something more useful: the per-unit COGS formula.
The Per-Unit COGS Formula
This is the one that actually matters for your day-to-day business:
COGS per Unit = Purchase Price + Inbound Shipping + Duties/Tariffs + Packaging + Any Other Direct Costs
Notice: we're not including your rent, software, or salary here. Those are operating expenses. COGS is the direct cost to deliver one unit to a customer.
Let's apply this to real scenarios.
Example 1: The Reseller (Candles)
You buy candles from a wholesale supplier and resell them on Shopify.
Supplier numbers:
- Purchase price per candle: $8.00
- You buy 200 units per order
- Inbound shipping for 200 units: $120 (that's $0.60 per unit)
- You use custom branded packaging: $0.80 per unit
Calculation:
| Cost Component | Per Unit |
|---|---|
| Wholesale price | $8.00 |
| Inbound shipping | $0.60 |
| Packaging | $0.80 |
| Total COGS per unit | $9.40 |
Wait—that's not what most resellers do. They'd say "I pay $8, I sell at $24, my margin is 67%." Wrong.
But there's more. Your supplier is in Vietnam. Sometimes orders get held at customs, and you need to pay duties:
- Average duty/tariff cost: $2.00 per unit
Updated COGS:
| Cost Component | Per Unit |
|---|---|
| Wholesale price | $8.00 |
| Inbound shipping | $0.60 |
| Duties | $2.00 |
| Packaging | $0.80 |
| Total COGS per unit | $11.40 |
Now you're selling at $24. Your real gross margin is:
($24 − $11.40) / $24 = 52.5%
Not 67%. That's a 14.5-percentage-point difference. On $100k in revenue, that's a $14,500 hit to your bottom line.
Track this automatically
Shopimize shows your real profit per order, per product, per channel.
Try Shopimize free →Example 2: The Manufacturer (Supplements)
You're manufacturing a supplement. You source raw materials, manage production, and pack everything in-house.
Your costs:
| Cost Component | Per Unit |
|---|---|
| Raw materials (vitamins, capsules, etc.) | $3.20 |
| Labor (filling, quality check) | $4.50 |
| Packaging (bottle + label + box) | $1.80 |
| Subtotal | $9.50 |
But you also have allocated overhead. Your facility rent is $4,000/month. You produce 1,900 units per month.
Overhead allocation:
- $4,000 / 1,900 = $2.10 per unit
Full COGS per unit:
| Cost Component | Per Unit |
|---|---|
| Raw materials | $3.20 |
| Labor | $4.50 |
| Packaging | $1.80 |
| Overhead allocation | $2.10 |
| Total COGS per unit | $11.60 |
You sell this supplement at $39.99. Gross margin:
($39.99 − $11.60) / $39.99 = 71%
That's strong. But here's what matters: if you didn't include overhead allocation, you'd calculate a 76% margin and make wrong decisions about ad spend. You might spend $8 per customer acquisition on a channel you thought was profitable, when really it's not.
Example 3: The Dropshipper (Niche Electronics)
Dropshipping feels like it should have low COGS. No inventory risk. No warehousing. Just supplier price + margin, right?
Not quite.
Your supplier quotes:
- Supplier cost per unit: $12.00
- You drop-ship directly to your customers
But here's what you need to add:
- Platform fees (Shopify apps, integrations, automation): $1.50 per unit (based on volume)
- Longer lead time = higher return rate. Your supplier ships from overseas in 2–3 weeks. Your return rate is 8% (vs. 3% for competitors with faster fulfillment). The cost of processing returns, restocking, and lost reputation: $2.40 per unit on average
- Payment processing fees: $0.30 per unit (Shopify Payments is ~2.7% on a $45 order)
- Packaging you still provide: $0.70 per unit
Adjusted COGS:
| Cost Component | Per Unit |
|---|---|
| Supplier cost | $12.00 |
| Platform/integration fees | $1.50 |
| Return rate cost | $2.40 |
| Payment processing | $0.30 |
| Packaging | $0.70 |
| Total COGS per unit | $15.90 |
If you sell at $45:
($45 − $15.90) / $45 = 64.7%
But if you'd ignored returns and fees? You'd think COGS is $12.70, margin is 71.8%, and you're making decisions on false math.
Why 10% COGS Error Costs You Thousands
Let's say your real annual revenue is $250,000 across 5,000 units sold.
Scenario A: You think COGS is 35% (wrong)
- Assumed gross profit: $250k × 65% = $162,500
- You spend 40% of revenue on marketing: $100,000
- You think you have $62,500 left for operations, salaries, profit
Scenario B: Real COGS is 45% (because you forgot shipping, duties, returns)
- Actual gross profit: $250k × 55% = $137,500
- Marketing spend: $100,000
- You actually have $37,500 left
- The gap: $25,000 in unexpected shortfall
That 10% COGS error cascaded into a 40% reduction in your actual operating margin.
And this affects more than just cash flow:
- Pricing: You might undercut competitors because you think you have more margin than you do
- Ad spend: You might spend $15 per customer acquisition on a channel that only works if your margin is 55%+, not 45%
- Scaling: You might hire team members based on profit projections that don't exist
- Strategy: You might double down on low-margin products thinking they're gold
The COGS Checklist: Costs Most Merchants Forget
Here's what to audit in your own COGS calculations:
Direct Product Costs:
- [ ] Supplier/manufacturer cost per unit
- [ ] Inbound shipping (from supplier to your warehouse or to customer)
- [ ] Duties, tariffs, and import fees
- [ ] Quality control rejections (factor in your defect rate)
Packaging & Delivery:
- [ ] Branded boxes, tissue, inserts, protective materials
- [ ] Shipping labels
- [ ] Tape, bubble wrap, padding
- [ ] Returns processing cost (label + restocking labor)
Hidden Platform Costs:
- [ ] Shopify app subscriptions (allocated per unit)
- [ ] Payment processing fees (2.7% + 30¢ on Shopify Payments, or 2.9% + 30¢ for third-party)
- [ ] Return management fees (if using a third-party platform)
Operational COGS:
- [ ] Allocated labor (only if you're manufacturing or hand-packing)
- [ ] Facility overhead (warehouse rent allocated by volume)
- [ ] Quality assurance costs
Risk Costs:
- [ ] Average return rate impact ($ value of returned inventory + restocking labor)
- [ ] Chargeback fees (if your fraud/chargeback rate is above average)
Overhead Allocation:
- [ ] If you manufacture: rent, utilities, equipment depreciation
- [ ] Only allocate based on production volume; don't include marketing or sales
[IMAGE PLACEHOLDER: Diagram showing three product types and their COGS breakdowns]

How to Calculate COGS for Your Shopify Store
Step 1: Choose your accounting period (month, quarter, or year)
Step 2: List all inventory you had at the start
- This is your Beginning Inventory value
Step 3: Add all purchases you made during the period
- Include supplier costs + inbound shipping + any other direct acquisition costs
Step 4: Subtract ending inventory
- What you have left at the end of the period, valued at cost
Step 5: The result is period COGS
Step 6: For per-unit COGS:
- Take period COGS and divide by units sold
Or: track costs per unit as you source (easier for Shopify sellers)
Common COGS Mistakes (And How to Fix Them)
Mistake 1: Only counting supplier cost
- What you're missing: shipping, duties, packaging, returns
- Fix: Use the per-unit formula above and audit every line item
Mistake 2: Including operating expenses in COGS
- What you're doing: adding your salary, rent, software costs
- Fix: Those are operating expenses, not COGS. Keep them separate for accurate margin analysis
Mistake 3: Forgetting payment processing fees
- What you're missing: Shopify Payments is 2.7% + 30¢. That adds up
- Fix: Allocate it per unit. If your average order is $40 and processing is $1.28, add that to COGS
Mistake 4: Not accounting for returns
- What you're missing: the real cost of processing, labor, and lost inventory
- Fix: Calculate your average return rate. Add the cost per returned unit to your COGS calculation
Mistake 5: Ignoring duties and tariffs as "one-time"
- What you're doing: spreading them over the wrong number of units, or skipping them
- Fix: Track duties by purchase order and allocate to the exact units affected
The COGS Formula in Your Shopify Analytics
If you're using Shopimize or another profit analytics tool, here's what should be happening automatically:
- COGS per order = sum of COGS for all line items in that order
- Gross margin = (Order revenue − COGS) / Revenue
- Your dashboard should show COGS trend over time and by product
If you're tracking COGS in Shopify itself:
- Go to Products > select a product
- Look for the Cost per item field (you may need to enable it in settings)
- Enter your calculated per-unit COGS
- Shopify will show you gross margin in your reports
Real Numbers From Real Sellers
We analyzed anonymized data from Shopimize users across three niches:
Beauty/Personal Care (Resellers):
- Average perceived COGS: 32%
- Actual COGS after shipping/duties/packaging: 47%
- Gap: 15 percentage points
Supplements (Manufacturers):
- Average perceived COGS: 38%
- Actual COGS including overhead allocation: 42%
- Gap: 4 percentage points
Electronics (Dropshippers):
- Average perceived COGS: 40%
- Actual COGS including returns + fees: 58%
- Gap: 18 percentage points
The pattern: sellers who source physical goods internationally or deal with high return rates are most likely to underestimate COGS.
FAQ
Q: Do I need to include labor in COGS if I'm packing products myself?
A: Yes, but only if you're doing it as a core part of fulfillment. If you're a reseller packing boxes, allocate your hourly rate to the time spent packing. If you're a manufacturer, definitely include labor. If you're a dropshipper, no—that's the supplier's responsibility.
Q: What if my supplier gives me a freight quote that covers multiple products?
A: Allocate it based on weight or volume. If you're shipping $2,000 in candles and $1,000 in diffusers in the same container, and freight is $300, you'd allocate $200 to candles and $100 to diffusers (based on the 2:1 ratio).
Q: Should COGS include the cost of my logo on the packaging?
A: If it's a fixed upfront cost (design, setup), amortize it over the expected units you'll sell. If it's a per-unit printing cost (embroidering a logo on a t-shirt), yes—include it in COGS.
Q: Can COGS change if my supplier raises prices?
A: Yes. COGS is based on actual costs. If your supplier increases the wholesale price, your per-unit COGS goes up, and so does the accuracy of your margin calculations. This is why tracking supplier costs by purchase order is important.
Q: If I'm using the accounting formula (Beginning + Purchases − Ending), when do I use it vs. the per-unit formula?
A: Use the accounting formula for financial reporting and tax purposes. Use the per-unit formula for pricing and business decisions. Ideally, both methods should give you the same answer at the end of the period.
The Bottom Line
The COGS formula isn't complicated. But the details are where most Shopify sellers leave money on the table.

Start here:
COGS per Unit = Purchase Price + Inbound Shipping + Duties + Packaging + Direct Labor (if applicable) + Allocated Overhead (if applicable)
Then audit every line. That 10% gap between what you think COGS is and what it actually is? It'll cost you thousands in mispriced products, wasted ad spend, and false confidence in unprofitable channels.
Want Your COGS Calculated Automatically?
Tracking COGS across hundreds of SKUs, multiple suppliers, and fluctuating shipping costs is painful. Want your COGS calculated automatically—per product, per variant, per order?
Try Shopimize free and see your real gross margin in minutes. No credit card required.
