MarginLine
GuidesSample reportPrivacyApp Store

Guides

Shopify COGS: how to track cost of goods sold accurately

Track Shopify cost of goods from the inventory cost at the time of sale, including restocked refunds and costs that were never entered.

The cost on the product today is not the cost of last month’s sales

Shopify’s inventory item has one unit cost. It is the cost you believe the next unit is worth, or the cost your supplier last invoiced. It is a current fact. Cost of goods sold is a historical fact: what you had already spent on the units that left and did not come back. Those two numbers match only on the day you sell the unit. The next morning they can diverge, and they should.

If you report COGS by multiplying units sold by the cost sitting on the product today, a supplier increase rewrites last quarter. Margins fall on orders you already shipped at the old cost. A supplier decrease does the opposite and makes an old, expensive run look clever. Either way you are describing a catalog, not the sales you made.

The accurate habit is a snapshot. When the order is imported, copy the unit cost onto the line and leave it there. The product page can change every week. The line keeps the cost it had. Your COGS for a date range is the sum of those snapshots for units that stayed out of inventory.

Where the number should live

Put the unit cost on the variant’s inventory item in Shopify. That is the field a selling app can read without asking you to maintain a second spreadsheet. Include, inside that unit cost, the pieces you want profit to reflect: the supplier price, the freight you can assign per unit, packaging, and duty if you know it per unit. A profit report that reads this field cannot add a landed-cost layer you never typed. If the duty is not in the unit cost, it is not in COGS.

Keep the cost in shop currency, converted by you at the rate you paid. Use one cost per variant when the variants do not cost the same. A report rolled up only to the product hides the color that loses money.

Restocks, lost units, and edits

COGS follows the unit, not the refund receipt. If you refund a unit and restock it, you have the item on the shelf again. Take it out of units sold and out of COGS. The refund column still shows the money you returned. If you refund a unit and do not restock it — it was damaged, used, or never came back — the unit is gone. Keep the cost. You paid for a unit you cannot sell again, and the refund does not rewind the supplier invoice.

On the sample shop, one canvas tote was refunded and restocked. The row keeps 2 units sold, $22.00 of refunds, and $15.00 of cost, which is the cost of the units that stayed out. The refunded unit is not in that cost. An order edit that removes a line before it is a sale is different again: there is no refund and no cost, because the unit was never sold.

Voided and expired checkouts are not sales. They can sit in the order list and still be ignored. Counting them as zero-dollar orders is harmless only if they contribute nothing to units, cost, or fees. A voided order with a leftover cost snapshot should not create a COGS line.

A missing cost is not zero

The most common COGS error in a young catalog is the empty field. Shopify lets you sell a variant with no unit cost. If the report treats that empty field as 0, every uncosted product looks perfectly profitable. $32.00 of sticker sales with a blank cost is not $32.00 of profit. It is an unknown. Leave profit blank and flag the row until someone types a cost.

Zero is allowed when it is true. A digital good you produce for nothing, or a goodwill replacement you choose to cost at zero, can be an explicit 0. The difference is that someone entered it. A blank means nobody has looked. Reports should not collapse those two states.

When you do fill a missing cost, write it onto the orders that never received a snapshot, and write it back to the inventory item so the next order inherits it. Do not overwrite snapshots that already exist. Those orders were costed on purpose, even if the number was lower. Filling a blank is not a license to recost history.

Two costs on the same SKU

A SKU can carry more than one snapshot in the same month. The sample mug was 3 units with $15.00 of cost altogether, because one order kept the old unit cost and a later order kept the new one. The row can show a single COGS total for the range without pretending every unit cost the same. If you need the audit, the orders are still there, each with the cost it captured.

This is also why a bulk edit of the Shopify cost field is safe for the future and dangerous for the past. Changing the inventory item changes the next import. It should not walk backward through orders that already have a number. A CSV of SKU or variant id and unit cost is the right tool when many blanks need filling: match the rows, reject the ones you cannot parse, and apply only to lines that are still empty.

Preview that file before you save it. An unmatched SKU is a typo, not a new product. An invalid amount is not zero. Applying a bad file is how a catalog of real costs gets replaced with blanks or with costs from the wrong column.

What COGS still will not decide

Accurate COGS does not, by itself, tell you whether the business made money. Rent, apps, payroll, and ads sit outside a per-SKU cost unless you choose to allocate them. Allocating rent by revenue is a management view. It is not the cost of the goods. Keep it out of the COGS column so you can still see the product decision: price, discount, supplier, and the label.

Payment fees and shipping labels are real costs of the sale, and they are not COGS. Put them in their own columns. A product with honest COGS can still lose money once the fee and the label are on it. Folding the label into COGS hides that, and you will renegotiate a supplier who was not the problem.

If you want this snapshot kept for you, MarginLine copies the inventory cost onto each imported line, drops COGS when a return is restocked, keeps it when the return is not, and leaves profit blank when the cost was never there. You can type a missing cost on the row or bring a CSV of blanks to fill. The sample report uses the same rules. It will not invent a landed cost you did not enter, and it will not recost an order that already has one.

Get MarginLine on the Shopify App Store

More guides

  • How to calculate profit per product on Shopify
  • Why your Shopify store's best sellers might be losing money
  • Sample profit report

MarginLine · marginline@comductor.com