Cost of goods sold = starting inventory + purchases − ending inventory
If you started the year with $20,000 of stock, bought $50,000 more, and ended with $25,000, your cost of goods sold was $45,000. Including landed cost in your purchases makes the figure, and your margins, more accurate.