Thanks for posting here in the Community forum, MarcinR.
I'm happy to provide information about how the Cost of Goods Sold (COGS) work in QuickBooks Online.
When setting up an inventory item, the system automatically adds two accounts to your Chart of Accounts. They are the Inventory Asset (Other Current Asset) and Cost of Goods Sold.
When an inventory item is bought, your Bill, Check or Credit Card Charge will debit the Item's Inventory Asset account and credit Accounts Payable (A/P) account. It will not be debited to an expense account since it is an asset that you can sell for future benefit and you record the expense to match the income.
Generally, COGS is affected only when you sell the items on invoices or sales receipts. This account isn’t meant for the items you use to create your products, such as raw materials. To know more on how it works, you can run the Transaction Journal for the invoice or sales receipt created.
For more details about how inventory works in QuickBooks, check out below articles:
If you have any additional questions about this topic, let me know by commenting below. I'm here to help anytime. Take care.