Automate month-end COGS and inventory journal entries for Shopify, Amazon and a 3PL
Updated · By Ecomsellertool editorial team
To automate month-end COGS, pull units sold per channel from Shopify and Amazon's Inventory Ledger, units received from your purchase order receipts, and restocked returns, write-offs and count adjustments from the 3PL and Amazon. Multiply each by the unit cost your accountant approved, roll opening inventory forward to a closing value, check it against the stock reports, and send one balanced draft entry to a person to approve.
- Closing inventory = opening value + received at landed cost − COGS + returns restocked − write-offs ± count adjustments. The workflow checks the result against month-end stock reports before anyone posts.
- QuickBooks Online inventory tracking is in the Plus and Advanced plans and costs items by FIFO or Moving Average Cost; the method cannot be changed later (checked December 3, 2026).
- In Xero, tracked items post COGS automatically using average cost; untracked items need a month-end manual journal, and Inventory-type accounts cannot be used on manual journals (checked December 3, 2026).
- Amazon's Inventory Ledger summary has monthly columns for receipts, customer shipments, customer returns, found, lost, damaged, disposed and the ending balance.
- Shopify reports profit only for variants that had a cost per item when they sold, and says that field is static.
- Rules count, price and draft. Your accountant picks the costing method and the accounts, and a person approves every entry before it posts.
The step map: who runs each step
Trigger: Month-end close, once Amazon's monthly Inventory Ledger, the 3PL's month-end stock report and every purchase order receipt for the month are in.
| Step | What happens | Who runs it |
|---|---|---|
| 1 | Units are pulled per SKU for the month: sold on Shopify, shipped by Amazon FBA, shipped by the 3PL for other channels, received on purchase orders, returned and restocked, written off and adjusted after counts. | Rule |
| 2 | Each SKU's unit cost is read from the approved landed-cost table for the month, the one your accountant signed off, never from a price typed into a store. | Rule |
| 3 | The roll-forward is built per SKU: opening value, plus receipts at landed cost, minus COGS per channel, plus restocked returns, minus write-offs, plus or minus count adjustments, equals the closing value. | Rule |
| 4 | The closing units are compared with the month-end stock reports from the 3PL, Amazon and Shopify. Any SKU outside your tolerance is held with both numbers, and missing costs or unknown SKUs stop the run. | Rule |
| 5 | One balanced draft journal entry is built for QuickBooks Online or Xero, with the accounts your accountant approved, the roll-forward attached and the debits equal to the credits. | Rule |
| 6 | The bookkeeper or accountant reviews the roll-forward, the held SKUs and the entry, decides each difference and approves or sends it back. | Person |
| 7 | The approved entry posts, the closing values are saved as next month's opening, and the period is marked closed in the log. | Rule |
6 rule steps · 0 AI model steps · 1 person step. A rule follows fixed logic you approve; an AI model handles messy input and its output is checked by rules; a person makes the calls listed below.
What stays with a person
- The costing method and the accounts behind every line, decided by your accountant
- Approving the journal entry before it posts, every month
- Each stock difference outside tolerance: recount, write off, or claim from the 3PL or Amazon
- Write-offs and how Amazon reimbursements are treated against them
- Unit cost changes in the landed-cost table
Which tools can run it
- A spreadsheet roll-forward fed by exported reports, with a person keying the entry, for a handful of SKUs
- QuickBooks Online or Xero inventory tracking, if every channel's sales reach the ledger item by item
- Zapier, Make or n8n pulling the reports into the roll-forward and sending the draft entry for approval, with a log of every run
- Custom code on your accounts, for many SKUs, several warehouses, cost history and a stock check before posting
Systems it connects
- Shopify
- Amazon Seller Central (FBA reports)
- 3PL stock and shipment reports
- Purchase order receipts
- Landed-cost table
- QuickBooks Online or Xero
- Approval queue in Slack or email
Build size: Medium
The arithmetic is simple; the work is getting matching units from four sources and holding unit costs steady for the month.
Payouts tell you what Amazon and Shopify paid you. They do not tell you what the goods you sold cost. That number, cost of goods sold, comes from units: how many left on each channel, how many came in, how many came back and how many were lost. For a brand selling on Shopify and Amazon FBA with stock at a 3PL, those units sit in four places, and someone rebuilds them in a spreadsheet every month. This recipe automates that month-end entry, with a bookkeeper or accountant approving it before it posts. It is one page of our automation library.
How does a month-end inventory roll-forward work?
Start from what you had, add what came in, subtract what went out, and you should land on what you have. That one line is the check that makes the journal entry safe to post. If the closing value it computes does not match the month-end stock reports, something was missed, and the month stops until a person finds it.
Closing inventory = opening value + received at landed cost − COGS (per channel) + returns restocked − write-offs ± count adjustments
Here is one month for two SKUs. The numbers are illustrative, not client data, and each SKU keeps one unit cost for the month so the arithmetic stays visible. In real books the costing method your accountant picks (FIFO or average cost) can change the cost per unit when prices change mid-month.
| Line (illustrative) | Tumbler units | Tumbler value at $7.50 | Lid set units | Lid set value at $2.20 | Total value |
|---|---|---|---|---|---|
| Opening inventory (last month's approved closing) | 4,000 | $30,000.00 | 6,000 | $13,200.00 | $43,200.00 |
| + Received on purchase orders, at landed cost | 3,000 | $22,500.00 | 2,500 | $5,500.00 | $28,000.00 |
| − Sold on Shopify (COGS) | 1,100 | $8,250.00 | 1,400 | $3,080.00 | $11,330.00 |
| − Shipped by Amazon FBA (COGS) | 2,300 | $17,250.00 | 1,900 | $4,180.00 | $21,430.00 |
| + Returns restocked as sellable | 60 | $450.00 | 30 | $66.00 | $516.00 |
| − Write-offs (damaged, disposed) | 40 | $300.00 | 25 | $55.00 | $355.00 |
| ± Count adjustments | −12 | −$90.00 | +8 | +$17.60 | −$72.40 |
| = Closing inventory | 3,608 | $27,060.00 | 5,213 | $11,468.60 | $38,528.60 |
| Check: on hand per 3PL, FBA and Shopify stock reports | 3,608 | 5,213 | Difference 0 |
The units add across each row: 4,000 + 3,000 − 1,100 − 2,300 + 60 − 40 − 12 = 3,608 tumblers, and 6,000 + 2,500 − 1,400 − 1,900 + 30 − 25 + 8 = 5,213 lid sets. Multiply by the unit cost and the closing value is $38,528.60. The last row is the one that matters. If the stock reports had shown 3,590 tumblers, the 18 missing units are either an unrecorded write-off or a count problem, and a person decides which before the entry posts.
From the roll-forward, the draft entry for the month reads like this, again illustrative. Net COGS is $11,330.00 + $21,430.00 − $516.00 = $32,244.00. Account names are placeholders for the ones your accountant chooses.
| Draft entry line (illustrative) | Debit | Credit |
|---|---|---|
| Cost of goods sold, Shopify | $11,330.00 | |
| Cost of goods sold, Amazon | $21,430.00 | |
| Cost of goods sold, returns restocked | $516.00 | |
| Inventory write-offs | $355.00 | |
| Inventory count adjustments | $72.40 | |
| Inventory asset | $32,671.40 | |
| Total | $33,187.40 | $33,187.40 |
The inventory asset falls by $32,671.40, which is $43,200.00 + $28,000.00 − $38,528.60. Receipts are left out of this entry because supplier bills usually post them already; if yours do not, your accountant adds that line. Debits equal credits, which QuickBooks requires: its guide says the total of the Debits column must equal the total of the Credits column.
Where does each number come from, and who checks it?
Each line has one source of units and one person who signs it off. Write this table down before you automate anything; most month-end errors are a line pulled from the wrong report, or the same units counted twice. All report details below are from the vendors' own pages (checked December 3, 2026).
| Line | Where the units come from | Who checks it |
|---|---|---|
| Opening inventory | Last month's approved closing roll-forward, which should equal the inventory asset in the ledger | Bookkeeper |
| Received at landed cost | Accepted units on each purchase order receipt from the 3PL, plus Receipts in Amazon's Inventory Ledger for goods sent to FBA. Unit cost from the approved landed-cost table | Purchasing lead for units, bookkeeper for cost |
| Sold on Shopify | Units fulfilled from Shopify orders by variant, matched to the 3PL's shipped report | Operations lead |
| Shipped by Amazon FBA | Customer Shipments in the Inventory Ledger summary, cross-checked with the Amazon Fulfilled Shipments report | Operations lead |
| Seller-fulfilled marketplace orders | The 3PL's shipped report for those channels | Operations lead |
| Returns restocked | 3PL return receipts with a sellable disposition; for FBA, the FBA Returns report's disposition and Customer Returns in the ledger | Operations lead |
| Write-offs | 3PL damage reports; Damaged, Lost and Disposed in the ledger; the Removal Order Detail report for disposals; the FBA Reimbursements report for units Amazon paid for | Accountant decides treatment |
| Count adjustments | Approved cycle counts at the 3PL; Found and Lost in the ledger | Operations lead, then bookkeeper |
| Closing check | 3PL month-end on-hand; the ledger's Ending Warehouse Balance and In Transit Between Warehouses; Shopify's Month-end inventory snapshot | Bookkeeper |
For Amazon, the source is the Inventory Ledger. Amazon's FBA report reference describes it as like a bank statement of your inventory. The summary view has columns for starting balance, receipts, customer shipments, customer returns, vendor returns, warehouse transfers, found, lost, damaged, disposed, other events, ending balance and unknown events, and it aggregates monthly by default. Monthly requests must start on the first of the month and end on its last day. The detailed view lists each movement and keeps 18 months of history (checked December 3, 2026).
For Shopify, the units are reliable but the costs are not a ledger. Its profit reports page says profit is reported only for variants that had a cost recorded when they sold, that the cost per item field is static, and suggests running financial reports in an accounting or ERP system instead. Its inventory reports page says the Month-end inventory snapshot includes only variants with inventory tracking turned on, and that a month stops updating about two days after it ends (all checked December 3, 2026). So run the close after that, and take unit costs from your own table, not from Shopify.
Two lines are where most brands go wrong. Receipts belong to the month the goods were accepted, not the month the bill arrived; our PO receiving discrepancies recipe produces exactly those accepted units. And write-offs are not the same as Amazon losses that Amazon reimbursed; our FBA reimbursements page covers how to track those claims.
Should you use QuickBooks or Xero inventory tracking, or a monthly journal entry?
Both ledgers can track inventory themselves. The catch is that they cost a sale only when that sale is recorded against an inventory item. If Amazon and Shopify reach your books as payout summaries, as our marketplace payouts recipe posts them, the ledger never sees item-level sales, and a monthly entry from the roll-forward is usually simpler. Your accountant decides; here is what each vendor says (checked December 3, 2026).
| Option | What the vendor says | Fits when |
|---|---|---|
| QuickBooks Online inventory tracking | Inventory features are in QuickBooks Online Plus and Advanced; Simple Start and Essentials users can buy an add-on or upgrade. Selling an item lowers quantity on hand; count differences use an inventory adjustment account, Inventory Shrinkage by default | Every sale on every channel is entered against a QuickBooks item |
| QuickBooks costing method | Intuit's inventory valuation article offers First In, First Out (FIFO) or Moving Average Cost. The method cannot be changed later, and items created before a choice default to FIFO | Decide with your accountant before the first item is set up |
| Xero tracked inventory | Xero's COGS guide says tracked items post COGS automatically using the average cost method. The Accounting API specification says an item is tracked when it has an inventory asset account and a COGS account, and that its value on hand is calculated using average cost accounting | Sales are entered as Xero invoices with item codes |
| Xero FIFO | Xero's US inventory page says the core software does not offer FIFO and points to apps from its App Store, naming EMERGE for FIFO costing | Your accountant wants FIFO and you stay on Xero |
| Periodic journal entry (QuickBooks or Xero) | QuickBooks journal entries must balance. Xero's COGS guide says that for untracked items, also called periodic inventory, you count closing stock and post a manual journal to cost of sales, and that Inventory-type accounts are reserved for tracked inventory and cannot be used on manual journals | Sales arrive as payout summaries; this recipe |
One thing follows from the Xero rule: if you post a periodic entry, the stock account it uses cannot be an Inventory-type account, so your accountant sets that account up before the first close. In QuickBooks, mixing both approaches on the same items counts the cost twice, so pick one.
What should stay with a person?
The method, the approval and every difference. Rules pull the units, price them from the approved cost table, build the roll-forward, compare it with the stock reports and draft a balanced entry. They never pick an account, change a unit cost or post a month with a difference outside tolerance. Your accountant chooses the costing method and the accounts. A bookkeeper approves each entry before it posts. A person decides whether missing units are a write-off, a recount or a claim against the 3PL or Amazon. There is no AI model in this recipe; every step is a rule or a person, which is what you want in your books.
Which tool should run it?
The simplest one that can read all four sources and stop a bad month.
| Level | Fits when | What to watch |
|---|---|---|
| Spreadsheet roll-forward from exported reports | A handful of SKUs, one 3PL | Someone must export the same reports on the same dates every month |
| QuickBooks Online or Xero inventory tracking | Every channel's sales reach the ledger item by item | Payout summaries never reach the item level; the method is fixed once chosen in QuickBooks |
| Zapier, Make or n8n | One 3PL with a stock report you can fetch, Amazon reports pulled on a schedule | Log every run and key each month, so a retry does not post twice; see our Zapier vs Make vs n8n comparison |
| Custom code on your accounts | Many SKUs, several warehouses, cost history, the stock check before posting | Can run on Ecomsellertool Growth OS beside inventory and payouts |
This entry sits at the end of a chain. Supplier bills from our supplier invoices recipe carry the costs that go into landed cost, and our supplier cost change alerts flag when that cost moves. Count differences come from our inventory count adjustments recipe, restocked returns from our returns, restock and refund recipe, and 3PL stock gaps from our 3PL reconciliation page. Once COGS is right per channel, contribution margin per channel is a short step further.
Who builds month-end COGS workflows for ecommerce brands?
Ecomsellertool builds this on your own marketplace accounts, 3PL reports and accounting system. We have built on Amazon's seller APIs since 2017 and shipped 50+ tools for 100+ teams. We agree the roll-forward, the sources and the approval step with your accountant first, then connect the reports and build the stock check and the draft entry. Send a project brief below, or see how our workflow automation service works.
The building blocks are work we have shipped:
- Landed costs with a history. For Zonkeepers, an accounting firm that manages seller accounts, we built a platform with profit and loss, landed costs and inventory management modules. Its landed cost module lets the team enter COGS or landed cost per product, supports multiple cost entries and keeps a historical record of each cost change.
- COGS next to fees and margin. For Selini, a business-to-business wholesale and ecommerce company, we built dashboards from Amazon's SP-API reports showing total COGS, average COGS per unit, fees and gross margin for Amazon-fulfilled and merchant-fulfilled sales.
Our guide to automating Amazon operations shows where finance reporting fits among the other workflows. You keep your accounts, your data and the custom code we build; the Growth OS base is licensed to you.
Get this workflow built
Send us your month-end close
Describe the workflow you want automated. We reply with a written plan: scope, timeline and a fixed price.
Frequently asked questions
How do I calculate COGS for an ecommerce store each month?
Multiply the units sold on each channel by the unit cost your accountant approved, then subtract the cost of returned units you put back into sellable stock. Write-offs and count adjustments are usually kept on their own lines so you can see them. Then check the result with a roll-forward: opening inventory plus receipts minus everything that left should equal what your stock reports show at month end.
Should I turn on inventory tracking in QuickBooks Online or post a monthly journal entry?
It depends on whether every sale reaches QuickBooks item by item. QuickBooks Online inventory tracking, in the Plus and Advanced plans, costs each sale by FIFO or Moving Average Cost, but only for sales recorded against its items. If Amazon and Shopify sales arrive as payout summaries, a monthly entry from a roll-forward is often simpler. Your accountant decides.
What is the difference between tracked and untracked inventory in Xero?
A tracked item has an inventory asset account and a cost of goods sold account, and Xero values it with average cost and posts COGS when it sells. For an untracked item, Xero does not calculate COGS, so you count closing stock and post a manual journal at month end. Inventory-type accounts cannot be used on manual journals.
Where do I find how many units Amazon FBA sold, lost or damaged in a month?
Amazon's Inventory Ledger report, in its summary view by month. It has columns for receipts, customer shipments, customer returns, vendor returns, warehouse transfers, found, lost, damaged, disposed, other events and the ending warehouse balance. The detailed view shows each movement and keeps 18 months of history.
How do returns affect COGS?
A returned unit that goes back into sellable stock comes back into inventory at its cost, which reduces COGS for the month. A returned unit that is damaged or thrown away does not; it becomes a write-off. The workflow uses the return's disposition from the 3PL or Amazon to tell the two apart.
Can automation post my COGS journal entry without anyone checking it?
It can, but it should not. The workflow builds and balances the entry and stops any month where stock reports disagree with the roll-forward. A bookkeeper or accountant still approves the entry before it posts, because a wrong unit cost or a missed write-off changes your gross margin and your balance sheet.
What unit cost should I use: the supplier price or landed cost?
Most brands use landed cost, the supplier price plus freight, duty and other costs to get the goods to your warehouse, but which costs go in and how they are spread is your accountant's call. Keep one approved table per month with the cost of each SKU and a history of changes.
