Cost, margin and valuation
How cost is tracked, how margin is derived, and what feeds the COGS report.
Each product carries a cost. That cost drives the COGS report, which multiplies quantity sold by the product's cost across the period. See COGS report.
How cost changes
You can type a cost on the product, set it by CSV import, or let deliveries set it. Receiving a purchase order blends the price you paid into the cost as a weighted average of the stock you already hold and the stock just received — or, if you prefer, replaces it with the latest price paid. A change made by hand, by import or by a delivery is recorded with the cost before and after. A sale keeps the cost it was made at, so a later change never rewrites past margins. See Receiving stock.
Units in a pending transfer between stores are not in the on-hand total the weighted average uses until the receiving store accepts the transfer.
Stock quantities are integers, and non-integer values are rejected at the API rather than being coerced. A fractional quantity would corrupt stock valuation, which sums quantity multiplied by cost.
Products with no cost
A product with no recorded cost contributes zero to COGS. That makes margin look better than it is, so populating cost is worth doing before trusting the report.