Shopify Cost of Goods Sold: The Real Number Behind Your Margin
Most Shopify stores miscalculate cost of goods sold by 10-20%. Here is what actually counts as COGS, what Shopify misses, and how to fix it for free.
You think your gross margin is 65%. Your bank account thinks it is 48%. One of you is wrong, and it is not the bank account.
This is the most common spreadsheet lie in Shopify land, and it almost always traces back to a wrong number for Shopify cost of goods sold. You priced a t-shirt at $30, your supplier charges $10, so you wrote down “67% margin” and went back to scaling ads. But the shirt also costs $2.40 in inbound freight, $1.20 in customs duty, $0.90 in Shopify Payments fees, and roughly $1.80 once you average in returns. Real cost is closer to $16.30. Real margin is 46%, not 67%.
Multiply that gap across 10,000 orders and you have built a business on the wrong number. This post covers what should go into your Shopify cost of goods sold calculation, what Shopify leaves out, why the gap matters at loan time, and how to fix it without a bookkeeper.
What Counts as Cost of Goods Sold for a Shopify Store
Cost of goods sold is the money you actually spent to put the product into the customer’s hands. Not your office rent. Not your Klaviyo bill. Not your founder salary. The cost that is directly tied to the unit you just sold.
For a Shopify store selling physical product, the honest list is shorter than people think and longer than Shopify’s “Cost per item” field suggests:
Always counts as COGS:
- The wholesale price you paid your supplier, manufacturer, or print-on-demand partner
- Inbound freight to get the product into your warehouse (sea freight, trucking, the FedEx bill on the case of mugs from Ohio)
- Import duty, customs broker fees, and tariffs
- Per-unit packaging that is part of the product (the candle’s tin, the shirt’s hangtag, the gift box if it ships in every order)
- Direct labor that touches the product, if you have it (the seamstress who hems the shirts, not your VA)
Sometimes counts, depends on how you treat it:
- Outbound shipping to the customer. If you charge for it, most accountants put it in COGS. If it’s free shipping baked into the price, it has to come out of margin somewhere, and COGS is the cleanest place
- Payment processing fees (Shopify Payments, PayPal, Shop Pay Installments). Some put these in operating expenses, but for honest unit economics, they belong in COGS
- Returns and refunds. The product comes back, sometimes resellable, often not. The unrecoverable portion is a COGS adjustment
Never counts as COGS:
- Marketing, ads, influencer fees
- Software subscriptions (Shopify itself, Klaviyo, Recharge, etc.)
- Office rent, utilities, founder salary
- Accountant fees, legal fees, your CPA’s bill
The IRS Schedule C definition of COGS is a useful gut-check here, and the IRS publishes a clear breakdown of what they expect to see. If a cost would not exist if you had sold zero units, it is probably not COGS.
What Shopify’s “Cost per Item” Field Actually Tracks
Shopify gives you one field per product variant called Cost per item. You enter the wholesale price you paid, and Shopify uses it to calculate a profit number in your reports. If you sell a $30 shirt and you entered $10 in Cost per item, Shopify reports $20 of profit per unit and a 67% margin.
That number is wrong. Or more accurately, it is incomplete in a way that always flatters you.
Shopify’s own help docs confirm the field only captures the unit cost you type in. It does not include:
- Inbound freight. If you import 1,000 mugs and the shipping was $1,800, that is $1.80 per mug, every mug, forever. Shopify will not add it.
- Customs and duties. Same story. A 10% tariff on imported apparel is real money. Shopify ignores it.
- Multi-warehouse cost differences. You buy mugs from two suppliers. One charges $4, one charges $5.20. Shopify shows one Cost per item, so half your COGS reports are off by 30%.
- FIFO vs average vs the last invoice. Your supplier raised prices three times this year. Shopify still shows whatever you typed in last. The mugs you actually sold today may have cost you $3.80 (old batch) or $5.20 (new batch). Shopify cannot tell.
- Returns. A returned shirt is COGS that should reverse. Shopify does not adjust the cost figure when a refund comes back.
So the “67% margin” you see in Shopify Analytics is a starting point, not the answer. Shopify COGS tracking is a feature Shopify gives you the data hooks for and expects your accounting tool to finish the job.
FIFO vs Average Cost, in Plain English
You do not need an accounting degree to run a store, but you do need to know which mug got sold so the right cost lands against it.
FIFO is “first batch in, first batch out.” You bought 500 mugs at $4 in January and 500 at $5.20 in March. When a customer buys one in April, FIFO says you sold a January mug and COGS for that order is $4.
Weighted average blends the two batches. Total cost was $4,600 for 1,000 mugs, so every mug is treated as $4.60 regardless of when it shipped.
Why does it matter? Because the IRS cares, and because your gross margin numbers can swing 5-15% during a price-rising period depending on which method you pick. For most clothing, candle, and mug brands, FIFO matches what actually happened on the shelf.
The deeper trade-off is in our companion post on FIFO vs weighted average. Short version: pick one, stick with it, and make sure your tools actually do the math. Shopify alone does not.
Why Wrong COGS Numbers Will Bite You
You can run a store on a wrong COGS number for a long time. The day it matters, it really matters.
SBA loan or line of credit. Banks underwriting a working-capital loan want to see a real gross margin number on your last two years of tax returns. If you reported COGS based on the Shopify field and the bank’s analyst recalculates including freight and duties, your margin shrinks, your debt-service-coverage ratio drops, and your loan offer gets cut by 30% or denied.
Investor due diligence. Same problem, sharper teeth. A buyer or VC running diligence will rebuild your unit economics from invoices. If your reported margin and your reconstructed margin disagree, you lose trust and you lose 10-30% on valuation.
Your own pricing decisions. This is the quiet one. You think a SKU is your best margin product so you push it in ads, but it is actually a freight-heavy import you have been losing money on. You discount a “high-margin” item in a Black Friday sale and find out in January it was your worst performer all along. Shopify gross margin numbers fed by partial COGS data drive the wrong calls every day.
Tax over- or under-payment. Understate COGS and you overpay tax on phantom profit. Overstate it and you eventually get audited. Either way, COGS is one of the IRS’s top audit triggers for ecommerce.
Why Multi-Warehouse Stores Get Wrecked the Hardest
If you sell from one warehouse, the cost story is messy but workable. If you ship from two or three (a 3PL on each coast, your own basement plus an Amazon FBA pool, print-on-demand alongside your own stock), the math turns into a mess no spreadsheet keeps up with.
Same SKU, two warehouses, two prices: which one did this order ship from, and what did that specific unit cost? You need to calculate COGS Shopify at the location level, not the global level. Multi-warehouse COGS is one of the things Shopify’s built-in reporting does not even attempt; it shows you one cost per variant and calls it a day.
This is exactly the gap most paid Shopify accounting apps charge premium-tier money to fill. A2X, for example, gates COGS tracking to its higher tier and still does not break it out per warehouse on the standard plans (see our full breakdown on the A2X comparison page). For a brand running $1M+ through two locations, that gap is real money.
How to Fix Your COGS Without Hiring a Bookkeeper
You have three options for getting an honest COGS number on a Shopify store.
Option 1: Spreadsheet it manually. Export your orders, export your inventory cost adjustments, calculate freight allocation per unit, recalculate at the end of every month. This works at very small scale (under 200 orders/month), eats one full day per month, and breaks the moment you add a second warehouse.
Option 2: Pay a bookkeeper plus a paid Shopify accounting app. A2X, Bookkeep, Synder, and similar tools sit between Shopify and QuickBooks or Xero. The best of them do per-transaction journal entries, payout reconciliation, and gift card deferred revenue. The catch: $29-229/month for the app, plus your bookkeeper’s hours, plus you still need premium tiers for COGS. You are looking at $400-1,500/month all in.
Option 3: Use ERPClaw, free. This is the option we built. ERPClaw is AI-native (the assistant is the primary interface) and runs Shopify COGS tracking automatically for every order, per warehouse, with FIFO valuation, and posts the journal entries straight into a built-in general ledger. No middleware, no QuickBooks subscription, no premium tier paywall. The full feature list is on our Shopify integration page, and pricing is documented (it is free, forever, open source) on our pricing page.
Here is what ERPClaw actually does for Shopify cost of goods sold out of the box:
- Watches every Shopify order webhook in real time and posts COGS at the moment of sale, not at month-end
- Tracks cost per warehouse, so a Toronto-shipped mug carries its $4 cost and an Atlanta-shipped mug carries its $5.20 cost into the same gross-margin report
- Uses FIFO by default, with a one-line config switch to weighted average if your accountant prefers it
- Reverses COGS automatically when a refund comes through, including partial refunds
- Lets you bake inbound freight and duty into landed cost so the field on the order shows the real number, not just the wholesale invoice price
- Publishes every journal-entry rule openly (we list the GL posting rules on the Shopify features page so you can see the math, not just the answer)
If you want to see how the install flow works on a real store, the Shopify install walkthrough is a five-minute walk-through. If you are evaluating against the broader ecommerce inventory cost stack, the for-ecommerce overview covers the rest of the picture: gift cards, payouts, returns, the lot.
Shopify Cost of Goods Sold FAQ
Does Shopify automatically calculate cost of goods sold?
Partially. Shopify uses the “Cost per item” field you enter on each product variant to compute a basic profit number in Shopify Analytics. It does not include inbound freight, duties, payment processing fees, or returns, and it does not handle multi-warehouse cost differences. For an accurate Shopify cost of goods sold number you need either a manual spreadsheet, a paid accounting app, or an ERP like ERPClaw that tracks landed cost and per-warehouse FIFO automatically.
What is the difference between cost of goods sold and operating expenses?
COGS is the cost directly tied to the units you sold (wholesale, freight in, duty, packaging). Operating expenses are the costs of running the business that exist whether you sell zero units or a million (rent, software, marketing, salaries). Both reduce your profit, but only COGS reduces your gross margin. A bank or buyer will look at gross margin to judge how strong the underlying product economics are, which is why getting COGS right matters more than getting operating expenses right.
Should shipping be included in cost of goods sold?
Inbound freight (getting product into your warehouse) is always COGS. Outbound shipping (sending it to the customer) depends on how you structure pricing. If you charge for shipping, most accountants put both the revenue and the cost in COGS. If you offer free shipping baked into the price, the cost has to come out of margin somewhere, and putting it in COGS gives you the most honest unit economics.
How do I calculate COGS Shopify when I have two warehouses with different costs?
You need a system that tracks cost at the inventory level, not just the variant level. Shopify shows one Cost per item per variant, so you cannot do this in Shopify alone. ERPClaw stores cost per warehouse and applies FIFO at the warehouse level, so an order shipped from your East Coast 3PL carries that warehouse’s cost and a West Coast order carries its own.
What is FIFO and do I have to use it for my Shopify store?
FIFO means “first in, first out.” When you bought one batch of mugs at $4 and a later batch at $5.20, FIFO says the next mug you sell came from the $4 batch. The IRS allows FIFO, weighted average, and a few other methods. You pick one, you stick with it, and you tell your accountant. Most Shopify stores find FIFO matches reality the closest because inventory genuinely flows oldest-first off the shelf.
Does ERPClaw really do COGS tracking for free?
Yes. ERPClaw is open-source under open source license. Per-warehouse FIFO COGS tracking is in the free tier; there is no premium tier. Compare that to A2X, which gates COGS to its $49+/month plan, on our A2X comparison page. The catch is that ERPClaw is self-hosted, so you run it on your own machine or server. If you want managed hosting with one-click backups, that’s on the roadmap; for now, the open-source self-hosted version is what is shipping.
How does ERPClaw handle returns and refunded COGS?
When Shopify sends the refund webhook, ERPClaw automatically reverses the original journal entry: credit COGS, debit inventory, exactly the inverse of the sale. Partial refunds reverse pro-rata. The result: your gross margin number always reflects net sales after returns, not gross sales, which is the number that actually matches what hit your bank account.
The Honest Closing Pitch
Shopify gives you a starting point. It does not give you the real Shopify cost of goods sold number, and the gap between the product-page field and your bank statement is where most stores lose visibility into actual unit economics. You can close it with a spreadsheet (slow), a paid app stack (expensive), or an open-source ERP that does the math for you (free).
ERPClaw installs in five minutes and connects to Shopify with one OAuth click. It tracks COGS per warehouse with FIFO valuation, posts the GL entries, and reverses them when refunds come back. No premium tier, no usage cap, no QuickBooks bill. Open source on GitHub. The pricing page is short because the price is zero.
Start with the Shopify install walkthrough, or read the full breakdown on our Shopify integration page. Whatever tool you pick, stop running ads against the wrong margin number. The bank account already knows.
Related posts
Agency Accounting, Project P&L, and Time Billing: A Real Guide
Why your friendly retainer client is secretly losing you $40 an hour, the four metrics every agency owner should know, and how to fix project P&L.
A2X Alternative: The Free Open-Source Tool Most Shopify Stores Don't Know About
Looking for an A2X alternative? ERPClaw uses the same clearing account method, books every order separately, includes per-warehouse stock costs, and costs $0. A founder's honest comparison.
AI Decorated vs AI Native Software: Why Most AI Features Will Lose
AI-decorated tools bolt a chatbot onto 2015 software and charge a new fee. AI-native software rebuilds the architecture. One of these wins. Here is why.