Understanding COGS: A Complete Guide for Shopify Merchants
What cost of goods sold (COGS) really includes for a Shopify store, worked through with one hot sauce shop's numbers, and how a missing freight bill turns into fake profit.
Say you run a hot sauce shop. Last month you sold 1,000 bottles at $12 each, and your profit report says you kept $8,000 of it.
That report trusts the $4.00 cost per item you typed in when you set the product up, which is what your co-packer charges per bottle. Then the freight invoice arrives, and the label printer's bill. Your real cost is $5.15 a bottle, and $1,150 of that $8,000 was never there.
We call that fake profit. Cost of goods sold is one of the easiest places for it to hide, so let's take it apart with this shop's numbers.
What COGS actually means
Cost of goods sold (COGS) is what the stock you sold cost you to get onto your shelf, ready to sell. Two words in that sentence do a lot of work.
"Sold" means COGS only counts the units that left with a customer this period. The 1,000 bottles still in the warehouse are inventory, not COGS, even though you paid for them with the rest of the batch.
"Ready to sell" means the cost isn't just the supplier's price. It's everything it took to get a sellable unit onto your shelf. People call that the landed cost.
Once you have COGS, two more numbers follow:
- Gross profit = revenue minus COGS
- Gross margin = gross profit divided by revenue, as a percentage
Gross margin is usually the number behind "we run at 60%." It's only as honest as the COGS underneath it.
The hot sauce shop's real cost per bottle
Here's the last batch, from the co-packer's invoice through to the bottles sitting in the warehouse.
| Cost | Batch total | Per bottle |
|---|---|---|
| Co-packer invoice (2,000 bottles at $4.00) | $8,000.00 | $4.00 |
| Freight from the co-packer to your warehouse | $1,300.00 | $0.65 |
| Custom labels and neck tags | $1,000.00 | $0.50 |
| Landed cost | $10,300.00 | $5.15 |
The $4.00 wasn't a careless guess. Shopify's own help page on cost per item suggests entering the price you paid the manufacturer, excluding shipping and other costs. Lots of stores do exactly that and stop there.
Here's what the gap does to one month of sales:
| Cost per item at $4.00 | Landed cost at $5.15 | |
|---|---|---|
| Revenue (1,000 bottles at $12) | $12,000 | $12,000 |
| COGS | $4,000 | $5,150 |
| Gross profit | $8,000 | $6,850 |
| Gross margin | 66.7% | 57.1% |
Same sauce, same sales. Nearly ten points of margin disappear once freight and labels are counted. Over twelve months like this one, that's $13,800 of profit that only ever existed on a dashboard.
How to calculate COGS
The formula fits on one line:
COGS = beginning inventory + purchases − ending inventory
We walk through the whole calculation, including what goes into a unit's cost and which Shopify reports add it up, in How to Calculate COGS on Shopify (Step by Step).
The costs below COGS still count
Payment fees, shipping labels and mailer boxes usually sit outside COGS. Leaving a cost out of COGS doesn't mean leaving it out of profit. It just moves further down the page. Here's one typical order of three bottles, with free shipping:
| Line | Amount |
|---|---|
| Order (3 bottles at $12) | $36.00 |
| COGS (3 × $5.15) | −$15.45 |
| Gross profit | $20.55 (57.1%) |
| Payment fee (2.9% + $0.30) | −$1.34 |
| Shipping label | −$7.50 |
| Mailer box and padding | −$0.90 |
| Left after the order ships | $10.81 (30.0%) |
The payment fee is the Shopify Payments online card rate on the Basic plan in the US, from Shopify's pricing page. Rates change, and yours depends on your plan and country, so use the one on your own statements.
So the 66.7% on the report is 30% once the box leaves the building. And nobody has bought an ad yet.
That's still a decent business. It's just a very different one from the one the report described.
When your costs change
Now say your costs move. By the start of March you're down to the last 500 bottles from that batch, at $5.15 each. Then the co-packer puts its price up by $0.50, and a new batch of 2,000 bottles lands at $5.65 each. You sell 1,000 bottles in March.
- Beginning inventory: 500 × $5.15 = $2,575
- Purchases: 2,000 × $5.65 = $11,300
That's $13,875 of stock on the shelf this month. You end March with 1,500 bottles. But which 1,500? The $5.15 ones or the $5.65 ones? Your answer sets the value of ending inventory, which sets COGS.
That's what a costing method decides.
The same month, three ways
Each common method answers "which bottles?" its own way:
- FIFO (first in, first out) assumes the oldest bottles go out first.
- Weighted average cost (WAC) blends every bottle on the shelf into one cost: ($2,575 + $11,300) ÷ 2,500 bottles = $5.55.
- LIFO (last in, first out) assumes the newest bottles go out first.
Here's March under each one:
| FIFO | Weighted average | LIFO | |
|---|---|---|---|
| Bottles sold, costed at | 500 at $5.15, then 500 at $5.65 | 1,000 at $5.55 | 1,000 at $5.65 |
| COGS | $5,400 | $5,550 | $5,650 |
| Gross profit | $6,600 | $6,450 | $6,350 |
| Gross margin | 55.0% | 53.8% | 52.9% |
| Ending inventory (1,500 bottles) | $8,475 | $8,325 | $8,225 |
Two checks keep this honest. First, COGS plus ending inventory is $13,875 under every method, which is everything on the shelf this month. Second, the formula gives the same answer: under FIFO, $2,575 + $11,300 − $8,475 = $5,400.
The three methods are $250 apart on the same sauce, the same sales and the same cash spent. Over a year of rising prices and a full catalog, that gap grows. We run all three methods through a longer example, including falling prices, in FIFO vs LIFO vs Weighted Average Cost on Shopify: Worked Examples.
Which method you use for your books is a decision to make with your accountant. For your own margin checks, the rule is simpler: pick one and use it for every product, every month.
Why Shopify's cost per item drifts
Shopify gives each variant one cost per item field. Shopify's Stocky migration guide says that cost stays fixed when you receive a purchase order or transfer. Two things follow from that.
It won't include freight or labels unless you add them yourself.
It won't change when the new batch lands. If you left $5.15 in place for March, every March sale would be costed at $5.15, for COGS of $5,150. That's $250 to $500 lower than any of the three methods above, and the difference shows up as profit you don't have.
Shopify does save the cost on each order when the order is created, so changing the field later won't rewrite past orders. That's useful. It also means a stale cost stays baked into every order placed while it was stale.
What a wrong COGS does to decisions
The bad number doesn't stay in the report. It feeds the next call you make.
Say you plan a 20% off weekend. At $9.60 a bottle, the report's view of a three-bottle order is $28.80 in sales minus $12.00 of COGS: $16.80 kept, so the promo looks comfortable.
The real view is $28.80, minus $15.45 of COGS, minus a $1.14 payment fee, the $7.50 label and the $0.90 box. That leaves $3.81 per order. The promo still makes money, just barely, and one extra cost would tip it over. You'd want to know that before you announce it.
The same thing happens with reordering. A product that looks like a strong seller on a $4.00 cost can turn out to barely cover its shipping on a $5.15 one, and you'd keep restocking it without knowing.
What to do now
- Pull the last batch's invoices for your best seller: supplier, freight, duties and labels. Add them up and divide by the units. That's your landed cost.
- Compare it with the cost per item in Shopify. If they differ, update the field and keep a dated note of the old number.
- Pick one costing method for every product, write it down, and tell your accountant which one you chose.
- Once a month, run beginning inventory + purchases − ending inventory. If it doesn't match the COGS your reports show, find out why before you trust the margin.
- Work out what's left on one typical order after fees, shipping and packaging.
Real profit, not dashboard profit. It takes one afternoon with your invoices to find out which one you've been looking at.
This is the math we're building CostSync to do. It keeps a history of what each product cost you and works out COGS and profit on every sale, using weighted average, FIFO or LIFO. CostSync is coming soon, and you can join the waitlist from the CostSync page.
Related articles
How to Calculate COGS on Shopify (Step by Step)
How to calculate cost of goods sold on Shopify, step by step: what goes into each unit's cost, where Cost per item lives, which Shopify reports add it up, and a worked month with example numbers.
FIFO vs LIFO vs Weighted Average Cost on Shopify: Worked Examples
FIFO vs LIFO for ecommerce, worked through with numbers. One mug, three purchase lots, three months of sales, and the COGS, ending inventory and gross margin each method gives you on Shopify.
Stocky Is Gone: How to Keep Average Cost on Shopify in 2026
Stocky shut down on 31/08/2026 and took its weighted average cost with it. What Stocky did for cost, what you lose without it, a spreadsheet method to keep average cost on Shopify, and what to look for in a Stocky alternative.