Cost of goods sold (COGS) is what the products you sold cost you. For an online store it is the units sold in a period times their unit cost, less the cost of refunded units that came back to stock or never shipped. It also equals opening stock plus purchases minus closing stock. Sales minus COGS is gross profit.
Cost of goods sold, COGS for short, is what the products you sold in a period cost you to buy or make. The formula for an online store is units sold times their unit cost, less the cost of refunded units that came back to stock or never shipped; counted from the stockroom, the same figure is opening stock plus purchases minus closing stock. Sales minus COGS is gross profit, the first margin on any P&L. Below: both methods worked on one month of a small store, what goes into the unit cost and what does not, which day each cost counts on, where Shopify keeps the figure, and what a COGS percentage has to leave room for.
In short
- COGS counts the goods only: shipping, packaging, payment fees and ads are costs of their own.
- A unit's cost counts on the day it was sold, at the cost that applied that day.
- A refund gives the cost back only for units that came back to stock or never shipped.
- A product with no unit cost is a gap to fill, never a cost of zero.
The COGS formula, two ways
There are two ways to arrive at the same number. The first works order by order, which is how an online store's sales arrive: every unit sold, at its unit cost, less the units refunded that went back on the shelf. The second works from the stockroom, which is how an accountant closes a year: what was in stock at the start, plus what was bought, minus what is in stock at the end. If the stock records are right the two agree; where they differ, the gap is shrinkage, damage or a count that was wrong, and finding which is worth an afternoon.
| Method | Formula | Use it when |
|---|---|---|
| Per order | units sold x unit cost - (units back in stock or never shipped) x unit cost | you want COGS for a day, a product or a month as it happens |
| Inventory | opening stock + purchases - closing stock | you close a year or check that the stock records hold |
Worked example: October 2026 at a small apparel store
The store sold 1.120 units in 740 orders, at a unit cost of €22,00: €24.640,00 of goods. During the month 110 units were refunded. 80 of them came back to stock, so their cost comes back too, €1.760,00. The other 30 were shipped and refunded without coming back, lost parcels and goodwill refunds, and their cost stays spent. COGS for the month is €24.640,00 minus €1.760,00, which is €22.880,00.
Against €60.000,00 of net revenue, sales after returns and without VAT, that is a COGS share of 38,1% and a gross profit of €37.120,00. The stockroom gives the same answer. The month opened with 2.400 units, €52.800,00 at cost; 1.200 units were bought for €26.400,00; the count at the end found 2.560 units, €56.320,00. €52.800,00 plus €26.400,00 minus €56.320,00 is €22.880,00.
| Step | Per order | Inventory |
|---|---|---|
| Start | €24.640,00 of units sold | €52.800,00 opening stock |
| Add or take off | - €1.760,00 of units back in stock | + €26.400,00 of purchases |
| Take off | - €56.320,00 closing stock | |
| COGS | €22.880,00 | €22.880,00 |
What goes into the unit cost, and what does not
The unit cost is what one unit cost to get onto your shelf: the supplier's price, plus the inbound freight, the duty and the currency conversion that came with it. That figure is the landed cost, and on imported goods it can sit well above the invoice price. Using the invoice price instead understates COGS on every unit, by the same share, every month.
What does not belong in it is everything that happens after the unit leaves the shelf. Shipping to the customer, pick and pack, the box and its packaging fees are logistics. The payment provider's cut is a transaction cost. Ads are marketing. Each has its own line further down the statement, and folding any of them into COGS makes gross profit look smaller and the costs below it look cheaper than they are, which hides exactly the line that needs attention.
Which day a cost counts on
A unit's cost counts on the day it was sold, at the unit cost that applied on that day. A supplier price that rose in April prices April's sales at the new cost and leaves March at March's, so a closed month stays closed. That needs costs with dates, which a single cost field per product cannot hold, as historical COGS on Shopify sets out.
A refund counts on the day it was issued, and it gives the cost back only when the unit came back to stock or never shipped at all. A unit that was shipped and refunded without coming back, a goodwill refund, a lost parcel, a damaged return thrown away, keeps its cost, because the goods are gone. A chargeback takes the money back and returns nothing, so its goods keep their cost as well. The credit for a returned unit is valued at its original cost, not at today's, which is why when a refund credits COGS matters more than it sounds.
Where to find COGS in Shopify
Shopify keeps one Cost per item for each product and variant, entered in the Price section of the product page. Shopify's help page on cost per item says the cost is recorded on an order when the order is created, and that a new cost is not applied to orders created before the change (checked 15 Nov 2026). Shopify's profit reports then show gross profit by product, by variant and by POS location, the profit margin of each order and the average margin by market, and report profit only for items that had a cost recorded when they were sold.
So a product sold before its cost was entered drops out of the profit figures rather than showing a cost, and the report stops at gross profit: what Shopify's COGS report leaves out covers the rest. Anyone pulling COGS for a month from Shopify should check first that every product sold carried a cost on the day it sold.
What is a good COGS percentage?
There is no figure that fits every store, because what matters is what the rest has to pay for. COGS as a share of net revenue is good when the margin left after it still covers shipping, payment fees, marketing and running costs with room to spare. In the example month those took €28.233,35, 47,1% of net revenue, so the store breaks even at a COGS share of 52,9%. At its actual 38,1% it kept 14,8% as EBITDA. A store with cheaper parcels or a smaller ad budget can carry a higher COGS share; one that buys its customers expensively needs a lower one.
Sales minus COGS
Sales minus COGS is gross profit, and as a share of sales it is the gross margin. On a nouz P&L it is CM1, the first contribution margin: net revenue minus COGS, €37.120,00 in the example month, 61,9%. It is the right first question, whether the goods make money, and the wrong last one, because three more families of cost still come off below it. The monthly P&L template carries the whole month line by line, and the profit margin formula in Excel shows the same subtraction for one product, cell by cell.
In nouz, COGS is line 17 of the statement, and what COGS means on a Shopify P&L comes down to four rules: every unit is priced at the cost that applied on its order date, a refund gives the cost back only for units back in stock or never shipped, each cost is entered once per variant with the day it starts, and Shopify's Cost per item is the starting value where it exists. A variant with no cost is flagged by name rather than counted as free, so the margin never looks better than it is.