Guide8 min read

Shopify COGS: How to Calculate Cost of Goods Sold

COGS is the foundation of ecommerce profitability. Learn the formula, what's included, how Shopify tracks it, and the mistakes that produce numbers you can't trust.

Last updated: April 2026

Researched by the ShelfMerge Research Team

Cost of goods sold is the total cost of products you actually sold during a period. Not what you bought. Not what's in your warehouse. What you sold. COGS is the single most important number for understanding whether your store is profitable — and Shopify merchants routinely get it wrong.

This guide covers the formula, what goes into COGS and what doesn't, how to track it in Shopify, and the mistakes that produce a number you can't rely on.

The cost of goods sold formula

COGS = Beginning Inventory + Purchases During Period − Ending Inventory

That's it. Three inputs. Here's what each one means:

Beginning Inventory — the cost value of all stock on hand at the start of your period (January 1st if you're doing annual COGS, or the first day of a quarter or month).

Purchases During Period — the total cost of inventory you bought from suppliers during the period. Include freight and import duties if you pay them — they're part of the cost of getting goods into your hands.

Ending Inventory — the cost value of all stock remaining at the end of your period. What you have left that hasn't been sold.

Example: You started the year with $30,000 of inventory at cost. You purchased $140,000 more during the year. You ended the year with $25,000 of inventory remaining. COGS = 30,000 + 140,000 − 25,000 = $145,000.

What COGS includes

COGS covers direct costs — costs that exist because you made or bought the product that was sold. For most Shopify merchants this means:

  • Product cost (wholesale price from your supplier)
  • Inbound shipping and freight from supplier to your warehouse
  • Import duties and customs fees
  • Manufacturing costs if you produce your own goods
  • Packaging that ships with the product (inner packaging, inserts)
  • Third-party inspection fees for quality control on inbound stock

These costs move with the product. When you sell a unit, you incur the cost of that unit. That's the definition of a COGS item.

What COGS does not include

This is where most merchants make errors — they include operating expenses that belong elsewhere on the income statement.

  • Shopify subscription fees
  • App fees and software subscriptions
  • Outbound shipping to customers (this is a fulfillment cost, not COGS)
  • Marketing and ad spend
  • Payment processing fees (Shopify Payments, Stripe, PayPal)
  • Staff wages (unless they're directly involved in manufacturing)
  • Returns shipping costs
  • Storage fees for unsold inventory (carrying cost, not COGS)

Mixing these into COGS overstates your cost of goods and understates gross margin. Your gross margin should reflect how much money you make on the sale of the product itself, before operating costs. That's the number that tells you whether your pricing is right.

Shopify-specific considerations

Entering cost per item in Shopify

Shopify tracks COGS only if you enter "Cost per item" on each product variant. Go to Products, open a product, scroll to the variant pricing section, and enter the cost. This is the amount you paid your supplier per unit, inclusive of freight and duties if you want accurate gross margin reporting.

If you sell in multiple variants (sizes, colors), each variant can have a different cost. A larger size may cost more to produce. A color that requires special dye may have a higher unit cost. Enter these separately — don't average them across variants.

Where to find COGS in Shopify reports

Once you've entered costs, Shopify surfaces COGS in two places:

Finances Summary (Analytics > Finances Summary): shows COGS as a line item alongside gross revenue and gross profit. This is your best quick reference for period COGS.

Product reports (Analytics > Reports > Product reports): shows COGS per product for the selected period. Useful for identifying which products are most expensive to sell.

Note: detailed financial reports are only available on Shopify Basic and above. The Starter plan doesn't include them.

Handling returns and refunds

When a customer returns a product and you restock it, Shopify adds the cost back to your inventory value — which reduces COGS for the period. This is correct behavior. If the returned item is damaged and you can't resell it, record it as an inventory adjustment at zero value. Otherwise your inventory value is overstated and your COGS is understated.

Bundles and kits

If you sell product bundles, Shopify doesn't automatically calculate bundle COGS from component costs. You'll need to either enter the total bundle cost manually as a product cost, or use an inventory management app that tracks bill of materials. Leaving bundle cost at zero makes your gross margin reports meaningless for those SKUs.

Inventory costing methods

When you buy the same product at different prices over time, which cost do you use when a unit sells? There are three methods:

FIFO (First In, First Out)

You sell the oldest stock first. If you bought 100 units at $10 and later bought 100 units at $12, the first 100 units sold are costed at $10. FIFO is the most common method for physical goods and gives you the most accurate reflection of current inventory cost.

LIFO (Last In, First Out)

You sell the newest stock first. Not commonly used in ecommerce and not allowed under IFRS (used in most countries outside the US). Skip this one unless your accountant specifically recommends it.

Weighted Average Cost

Every unit in inventory carries the same average cost, recalculated each time you purchase more. If you have 100 units at $10 and buy 100 more at $12, all 200 units are now costed at $11. This smooths out price fluctuations.

Shopify uses a moving average cost method. Each time you receive inventory, it recalculates the average cost across current stock plus new stock. This is close to weighted average. The practical implication: if your supplier raised prices recently, your reported unit cost is lower than your actual replacement cost until the older stock clears.

Calculating gross margin from COGS

Once you have COGS, gross profit and gross margin are simple:

Gross Profit = Net Revenue − COGS

Gross Margin % = (Gross Profit / Net Revenue) × 100

Using earlier numbers: $320,000 revenue, $145,000 COGS. Gross profit = $175,000. Gross margin = (175,000 / 320,000) × 100 = 54.7%.

Gross margin benchmarks vary by category but most ecommerce businesses target 40–60% gross margin. Below 30% leaves very little room for operating costs and profit. Above 70% is achievable in high-margin categories like digital goods, beauty, or branded apparel.

Common COGS mistakes Shopify merchants make

Not entering cost data at all

Shopify shows $0 COGS if you never entered cost per item. Every report will show 100% gross margin, which is useless. Fill in costs — even rough estimates are better than nothing. You can refine them over time.

Using retail price as cost

Some merchants enter the retail price instead of the wholesale cost. This produces a COGS that equals revenue, a gross margin of 0%, and completely wrong profitability data.

Forgetting to update costs when supplier prices change

If your supplier raised prices 15% but you didn't update Shopify's cost data, your COGS is understated and your gross margin is overstated. Set a reminder to audit cost data after every reorder.

Not accounting for freight

A unit that costs $8 from your supplier plus $2 in freight costs $10 to land. If you enter $8 as the cost, you're understating COGS by 20%. For low-margin products, that difference can be the gap between profit and loss.

Using COGS to make better inventory decisions

COGS connects directly to inventory health. Your inventory turnover ratio uses COGS as the numerator (COGS / average inventory value). Your per-product gross margin tells you which SKUs are worth restocking. Your carrying cost analysis uses inventory value at cost.

ShelfMerge's COGS calculator pulls directly from Shopify's cost data and breaks it down by product, category, and time period. If your cost data is clean, you get accurate gross margin per SKU alongside turnover rate and inventory health metrics — in one view, without building a spreadsheet.

Get the cost data right first. Everything else in inventory analytics depends on it.

Frequently asked questions

What is the cost of goods sold formula?

COGS = Beginning Inventory + Purchases During Period − Ending Inventory. Beginning inventory is the cost value of stock on hand at the start of the period. Purchases are all inventory bought during the period (including freight and duties). Ending inventory is the cost value of unsold stock at the end.

Does Shopify calculate COGS automatically?

Shopify calculates COGS only if you've entered 'Cost per item' on each product variant. If that data is present, the Finances Summary report shows COGS and gross profit. If you haven't entered costs, Shopify shows $0 COGS — making every margin report meaningless.

Does outbound shipping count as COGS?

No. Shipping charges to customers are a fulfillment cost, not COGS. COGS covers costs directly tied to producing or acquiring the product — supplier cost, inbound freight, import duties, and manufacturing. Outbound shipping goes on your income statement as an operating expense below gross profit.

What costing method does Shopify use?

Shopify uses a moving average cost method. Every time you receive new inventory, it recalculates the average cost across existing stock and new units. This means your reported unit cost adjusts gradually as prices change — it won't immediately reflect a supplier price increase until older stock clears.

Try ShelfMerge free

Connect your Shopify store and get a full catalog health report in under 60 seconds. Dead inventory, variant analysis, cannibalization detection — all automated.

Free plan available. No credit card required.