E Commerce

How to Calculate COGS for E-commerce — CPA Guide (2026)

How to Calculate COGS for E-commerce — CPA Guide (2026)

At a Glance

Best ForCanadian e-commerce sellers who want accurate profitability reporting
Key FormulaCOGS = Product Cost + Shipping to Warehouse + Duties + Packaging
Recommended MethodWeighted average cost — simplest and most practical for most online sellers
Common MistakeExcluding freight, duties, and brokerage from landed cost calculations

Understanding how to calculate COGS for e-commerce is the single most important step toward knowing whether your online business is actually profitable. Cost of goods sold for e-commerce directly determines your gross margin, affects your taxable income, and shapes every financial decision you make as a seller. Yet most Shopify and Amazon sellers get COGS wrong — not because the math is hard, but because they exclude landed costs like freight, customs duties, and brokerage fees from their per-unit calculations. The result is an inflated gross margin that masks the true economics of their business.

This guide walks you through the correct way to calculate COGS as a Canadian e-commerce seller, with worked examples for both Shopify and Amazon FBA. We use this exact methodology with our e-commerce accounting clients at LedgerLogic, and it aligns with CRA requirements for inventory valuation. For the broader framework, see our complete guide to e-commerce accounting in Canada.

Affiliate Disclosure: LedgerLogic is a Xero, A2X, and Synder partner. We may earn a commission if you sign up through our links at no extra cost to you. We only recommend tools we use with our own clients.

Need Help Calculating Your E-commerce COGS?

Our CPA team sets up proper COGS tracking in Xero for Shopify and Amazon sellers. We calculate your landed costs, configure inventory accounts, and automate the posting through A2X.

What Counts as COGS for E-commerce

The Canada Revenue Agency defines cost of goods sold as the direct costs attributable to the production or acquisition of goods that a business sells during a reporting period. For e-commerce sellers who purchase finished goods for resale, COGS includes every cost required to get that product from your supplier to a state where it is ready to sell. The CRA's guidance on cost of goods sold outlines the core principles.

Costs That Belong in COGS

These are direct costs tied to acquiring or producing the goods you sell:

  • Product purchase cost — the price you pay your supplier per unit
  • Freight and shipping to your warehouse or FBA — ocean freight, air freight, courier charges to get inventory to your storage location
  • Customs duties and brokerage fees — import duties assessed by CBSA and the brokerage fees charged by your customs broker
  • Packaging materials — boxes, poly mailers, branded inserts, and any packaging consumed in the fulfilment process

Costs That Are Operating Expenses (Not COGS)

These are indirect costs that support your business but are not directly tied to acquiring inventory:

  • Advertising and marketing spend (Facebook Ads, Google Ads, influencer fees)
  • Software subscriptions (Shopify plan, email marketing tools, analytics)
  • Warehouse rent and utilities
  • Salaries and wages (unless employees are directly involved in production)
  • Office supplies and general administrative costs

The Grey Area: Platform Selling Fees

This is where reasonable accountants disagree. Amazon referral fees (typically 15% of the selling price) and Shopify transaction fees are directly tied to each individual sale — no sale, no fee. At LedgerLogic, we classify these as COGS because they behave like a variable cost of selling. However, some firms classify them as operating expenses because the seller does not "acquire" them as part of inventory.

Either approach is acceptable under Canadian accounting standards, but you must be consistent. Whichever classification you choose, apply it across all reporting periods. We will show both approaches in the Amazon FBA example below so you can see the impact on your gross margin. For a full breakdown of where each line item belongs, see our e-commerce chart of accounts guide.

COGS Calculation Methods

Canadian e-commerce sellers must choose a consistent method for valuing their inventory and calculating COGS. The three methods recognised by the CRA are FIFO, weighted average, and specific identification. Each produces different COGS figures when your purchase costs fluctuate over time.

FIFO (First In, First Out)

Under FIFO, you assume the oldest inventory is sold first. This method works well for products with expiry dates, seasonal pricing, or situations where your purchase costs change significantly between orders. FIFO tends to produce lower COGS (and higher taxable income) when costs are rising, because the older, cheaper units are matched against revenue first.

Best for: perishable goods, fashion and seasonal items, products with fluctuating supplier costs.

Weighted Average Cost (Recommended for Most E-commerce Sellers)

Under weighted average, you calculate a single average cost per unit by dividing total inventory costs by total units available. Every time you receive a new shipment, the average is recalculated. This is the simplest method and the one we recommend for most e-commerce sellers with relatively consistent purchase costs.

Best for: sellers with stable supplier pricing, high-volume SKUs, businesses that want simplicity without sacrificing accuracy.

CPA Pro Tip: Once you select a COGS calculation method, the CRA expects you to use it consistently year over year. Switching from FIFO to weighted average (or vice versa) without CRA approval can trigger questions during an audit. Choose your method early and document your rationale.

Specific Identification

Under specific identification, you track the exact cost of each individual item sold. This is only practical for sellers dealing in high-value, unique products — think vintage watches, one-of-a-kind artwork, or custom-manufactured goods where each unit has a materially different cost.

Best for: high-value, low-volume, unique items where per-unit tracking is feasible.

Worked Example — Shopify Seller

Let us walk through a realistic example for a Canadian Shopify seller importing products from overseas.

Scenario: You import 500 units of a product from a supplier in China. The product cost is $8.00 CAD per unit. Your freight forwarder charges $600 for ocean shipping to your Canadian warehouse, and you pay $200 in customs duties and brokerage fees at the border.

Calculating Landed Cost Per Unit

Cost Component Total Cost Per Unit (500 units)
Product purchase cost $4,000.00 $8.00
Freight (ocean shipping) $600.00 $1.20
Customs duties and brokerage $200.00 $0.40
Landed cost $4,800.00 $9.60

Landed cost per unit: ($4,000 + $600 + $200) / 500 = $9.60 per unit

Calculating COGS for the Period

If you sold 350 units during the period:

COGS = 350 units x $9.60 = $3,360.00

Your remaining 150 units are valued at $9.60 each ($1,440) on your balance sheet as ending inventory.

Journal Entry Format

When you record the sale of these 350 units, your accounting entries look like this:

To record COGS:
Debit: Cost of Goods Sold — $3,360.00
Credit: Inventory — $3,360.00

This entry moves the cost from your balance sheet (inventory asset) to your income statement (COGS expense), reducing your taxable gross profit accordingly. For help configuring these accounts, see our Shopify bookkeeping guide.

Worked Example — Amazon FBA Seller

Amazon FBA sellers face additional costs that Shopify sellers do not: FBA fulfilment fees, Amazon referral fees, and monthly storage fees. Whether you include these in COGS or classify them as operating expenses significantly affects your reported gross margin.

Scenario: Same product as above — landed cost of $9.60 per unit. You sell the product on Amazon for $29.99 CAD. Amazon charges a $3.50 FBA fulfilment fee per unit, a 15% referral fee ($4.50 per unit), and $0.30 per unit in monthly storage fees.

Two Classification Approaches Compared

Line Item Approach A: Platform Fees in COGS Approach B: Platform Fees as OpEx
Landed cost per unit $9.60 $9.60
FBA fulfilment fee $3.50 Separate expense line
Amazon referral fee (15%) $4.50 Separate expense line
Storage fees $0.30 Separate expense line
Total COGS per unit $17.90 $9.60
Gross margin per unit $12.09 (40.3%) $20.39 (68.0%)
Gross margin after OpEx fees $12.09 (40.3%) $12.09 (40.3%)

Notice that while the classification changes the gross margin line, the net result is identical. The difference is in how your financial statements present the information. Approach A gives you a more conservative (and we believe more useful) gross margin that reflects the true cost of each sale. Approach B separates platform fees for easier comparison if you sell across multiple channels.

For 350 units sold under Approach A: COGS = 350 x $17.90 = $6,265.00
For 350 units sold under Approach B: COGS = 350 x $9.60 = $3,360.00 (with $2,905 in separate platform fee expenses)

For more on structuring your Amazon FBA accounting, see our Amazon FBA accounting guide.

How to Track COGS in Xero

Once you understand your COGS calculation, you need a system to track it accurately in your accounting software. We recommend Xero for Canadian e-commerce sellers, and there are three approaches depending on your volume and complexity.

Approach 1 — Manual Journal Entries (Small Volume)

If you sell fewer than 50 units per month and have a single SKU or a handful of products, you can create manual journal entries in Xero at month-end. Calculate your COGS using the formulas above, then debit Cost of Goods Sold and credit Inventory for the total amount. This works but becomes unsustainable as you scale.

Approach 2 — Xero Inventory Tracking (Medium Volume)

Xero has built-in inventory tracking that calculates COGS using the weighted average method automatically. When you create a purchase bill and receive inventory into Xero, it updates the weighted average cost. When you create a sales invoice, Xero automatically posts the corresponding COGS entry. This is a solid mid-range solution for sellers with moderate SKU counts who want automation without additional software costs.

Approach 3 — A2X Automated COGS Posting (Recommended for Shopify and Amazon)

For Shopify and Amazon sellers, A2X is the recommended solution. A2X connects to your selling platform, pulls transaction data, and creates properly categorised journal entries in Xero that include COGS postings based on your configured cost-per-unit. This eliminates manual work, reduces errors, and ensures every payout reconciliation includes the correct COGS figure.

A2X also handles multi-currency COGS if you sell in USD on Amazon.com, converting your costs at the appropriate exchange rate for each posting period.

Why COGS Matters for Your Taxes

COGS is not just an accounting exercise — it directly reduces your taxable income. The higher your accurately calculated COGS, the lower your gross profit, and the less tax you owe. But the emphasis must be on "accurately calculated." Inflating COGS with costs that do not legitimately belong there invites CRA scrutiny, while understating COGS by excluding landed costs means you pay more tax than necessary.

CRA Requirements for Inventory Records

The CRA requires Canadian businesses that carry inventory to maintain records of:

  • Opening inventory — the value of inventory at the start of your fiscal year
  • Purchases during the year — all costs of acquiring new inventory, including landed costs
  • Closing inventory — the value of inventory at the end of your fiscal year, measured at the lower of cost or fair market value
  • Method used — FIFO, weighted average, or specific identification, applied consistently

Your COGS is then calculated as: Opening Inventory + Purchases - Closing Inventory = COGS. This figure flows directly to your T2 corporate return or your T2125 statement of business activities if you operate as a sole proprietor.

Consistency Is Mandatory

The CRA expects you to use the same inventory valuation method consistently from year to year. Switching from FIFO to weighted average — or changing how you classify platform fees — without a defensible reason can raise questions during an audit. If you do need to change methods, consult with your accountant about whether CRA approval is required.

CPA Pro Tip: Keep every purchase invoice, freight bill, customs declaration, and brokerage receipt tied to your inventory purchases. If the CRA asks you to substantiate your COGS, you need to trace every dollar from the supplier invoice through to the landed cost calculation. A folder in Dext labelled "Inventory Purchases" makes this effortless — forward receipts as they arrive and they are stored, categorised, and pushed to Xero automatically.

Frequently Asked Questions

Written By

Seb ProstCPA, Ex-CRA

Licensed CPA with 10+ years of experience, including work with the Canada Revenue Agency. Founder of LedgerLogic, a cloud accounting firm serving Canadian SMEs. Xero Certified Advisor.