Get your taxes done using TurboTax

The ending inventory is what determines how much gets sent to COGS.

So Beginning inventory

plus purchases

less ending inventory

= COGS