COGS (Cost of Goods Sold)

COGS (cost of goods sold) is what the products you sold cost you: purchase or production price, plus inbound freight, import duties and other costs of getting them ready for sale, minus supplier discounts. Net revenue minus COGS is gross profit, CM1 in e-commerce.

Daniel Busch
Written by Daniel Busch · Chief of Staff · Updated

In short

  • Per period: COGS = beginning inventory + purchases − ending inventory. Per order: units sold × landed cost per unit
  • In: purchase price, inbound freight, import duties, product packaging, net of supplier discounts. Out: shipping to customers, payment fees, marketing
  • Net revenue − COGS = gross profit (CM1); divided by net revenue, the gross margin
  • A product without a cost inflates your margin without a trace; Shopify's profit reports leave such products out
  • Returned items that go back into stock give back their COGS; items you write off keep it

What counts as COGS in e-commerce

COGS is the cost of the units you sold in a period, not of everything you bought in it: unsold stock stays on the balance sheet until it sells. For a shop that buys finished goods, it is the landed cost of each unit sold, what it took to buy the unit and get it onto your shelf. International accounting counts all costs of purchase and conversion, and the other costs of bringing inventory to its present location and condition (IAS 2). The IRS counts freight-in and the prices you actually paid, after trade discounts (IRS Publication 334).

In COGSNot in COGS
Purchase price, net of supplier discounts and rebatesInput VAT you can reclaim, including import VAT
Inbound freight and insurance to your warehouseShipping to customers (a CM2 cost)
Import dutiesPick, pack and shipping boxes (CM2)
Production costs and product packaging, for your own brandPayment fees (CM2)
Write-offs of stock you can’t sell, including unsellable returnsMarketing (CM3), salaries and rent (fixed costs)

Net revenue minus COGS is gross profit, the CM1 of the contribution margin scheme; divided by net revenue, it is the gross margin. In our customer threads, “product costs” comes up as often as “COGS”, and both mean this line.

In Shopify, COGS lives in one field per product and variant: cost per item. Its profit reports count only products and variants that had a cost recorded when they were sold (Shopify), so a missing cost takes the sale out of the profit report instead of counting it as free.

How to calculate COGS

Per period, the way your accountant does it: COGS = beginning inventory + purchases, including freight-in and duties − ending inventory. With €40,000 of stock on 1 October, €30,000 of purchases in October and €38,000 of stock on 31 October, October’s COGS is €32,000.

Per order, the way a dashboard does it: units sold × landed cost per unit. That needs a landed cost for every product:

Landed cost of one unit
Supplier price€12.00
− Supplier discount, 5%−€0.60
+ Inbound freight per unit€1.10
+ Import duty per unit€1.20
+ Product packaging€0.30
= Landed cost€14.00

An order of three units at €47.60 each, including 19% VAT, brings €120.00 of net revenue. COGS: 3 × €14.00 = €42.00. CM1: €78.00, a gross margin of 65%. If one of the three products had no cost on file, the dashboard would show €92.00 of CM1 and a gross margin of 76.7%, and nothing in the totals would tell you why.

Missing costs, refunds and cost changes

Three questions about COGS came up in our customer calls this year, and each has a clear answer.

“Which cost applies when a product has no COGS?” Never zero. A missing cost makes a product look like pure margin, and new products, bundles and variants are where costs go missing. Our view: give every product without a cost a fallback, such as the average cost share of its category, and keep a list of what runs on the fallback until someone fills it in.

“Are COGS zeroed on every refund, or only on restocks?” Only on restocks. A returned unit that goes back into stock gives back its cost. A unit you write off keeps it, and so does a refund without a return, such as a goodwill refund. Zeroing COGS on every refund makes returns look cheaper than they are (return rate).

“Our costs live in the ERP.” Then the ERP stays the source, and a daily export to a sheet or a database table is the bridge. Store each cost with the date from which it applies: a single cost per product, overwritten when the supplier raises prices, rewrites last year’s margins with this year’s prices.

How adtribute brings in product costs

In adtribute’s marketing attribution and analytics platform, costs reach your orders as attributes (docs: Getting Started with Definitions). A Google Sheets Lookup assigns values from a sheet; a BigQuery Lookup assigns them from a table in your own BigQuery project, joined on columns you choose, such as the order ID. For rows the table has no value for, a BigQuery lookup takes a default, another attribute or a constant (docs: BigQuery Lookup Attribute), and that default is where a fallback cost goes.

CM1 and CM2 are among the margins your order conversion can carry as attributes (how adtribute calculates contribution margin). A changed attribute shows the next morning for all past dates, so a cost you correct today corrects the past as well.

FAQ about COGS

Is shipping part of COGS?

Inbound freight, from your supplier to your warehouse, is. Shipping to the customer is not: it is a cost of selling, which e-commerce teams put into CM2 together with fulfilment and payment fees.

Are payment fees part of COGS?

No. They come with the sale, not with the product, so they belong to CM2. What happens to them on a refund is in the contribution margin cost table.

Is VAT part of COGS?

Not if you can reclaim it. Input VAT on your purchases, import VAT included, comes back from the tax office, so COGS is counted net of it, like your revenue. Import duties don’t come back and belong in COGS.

How do I track COGS in Shopify?

Enter a cost per item for every product and variant, and fill it in for new products before they sell. Shopify’s profit reports leave out variants that had no cost at the time of sale, so their net sales come out lower than in the sales reports.

Should warehouse and fulfilment costs be in COGS?

Keep pick, pack and per-order warehouse fees out of COGS and in CM2. They rise with orders, not with what a product costs, and keeping them apart shows whether a margin problem sits in the product or in the logistics.