智慧记
Ailit
产品官网
English
简体中文
English

Product Cost Calculation Logic

最新修改于 2026-07-15

Product Cost Calculation Logic

Is the product cost incorrect? Does it not match the purchase price? How is it calculated? Let’s take a look at this tutorial.

Initial Product Cost Exists

Initial Inventory and Cost Were Entered When the Product Was Created

When you create a product, you enter both the initial inventory and the initial cost. In this case, as long as no purchase order has been created to replenish the product, the unit cost of the product is the initial cost you entered. At this point, the product cost is independent of the purchase price and depends solely on the initial cost you specified. Description

If, after a sales order has been completed, you return to the product information and modify the initial cost, the unit cost in the sales order will also change accordingly.

After Entering Initial Cost and Inventory, a Purchase Order Is Created to Replenish the Product

Once a product has initial inventory and initial cost, creating a purchase order to restock it will calculate the product cost using the moving weighted-average method:

Scenario 1: The initial inventory has not yet been fully sold

For example, you enter an initial inventory of 10 units with an initial cost of 50; after selling 5 units, you issue a purchase order to restock 5 units at a purchase price of 60. The product cost is then calculated as: (Remaining initial inventory × Initial cost + Purchased inventory × Purchase price) / (Remaining initial inventory + Purchased inventory), which is (5×50 + 5×60) / (5+5) = 55. From this point on, each sale will use a unit cost of 55. Description

Scenario 2: The initial inventory has been fully sold, and a purchase order is issued to restock the product; in this case, the product cost equals the unit price listed on the purchase order.

For example, you enter an initial inventory of 10 units with an initial cost of 50. After selling all 10, you issue another purchase order for 5 units at a purchase price of 60. Using the moving weighted-average method, the calculation is: (Remaining initial inventory × Initial cost + Purchased inventory × Purchase price) / (Remaining initial inventory + Purchased inventory), which comes out to (0×50 + 5×60) / (0+5) = 60—identical to the purchase price. Description

Scenario 3: Negative‑inventory sales occur before a purchase order is placed to restock the product

For example, you enter an initial inventory of 10 units with an initial cost of 50, but sell 15 units, leaving a negative inventory of -5. You then issue a purchase order for 10 units at a purchase price of 60. In this case, the previously sold units at negative inventory retain their original cost of 50 per unit, while the newly purchased units are priced at 60 each. After restocking, the 5 new units are used to offset the prior negative sales, and the remaining 5 have a cost of 60, whereas the 5 units that were offset still carry the original cost of 50. Description

No Initial Inventory or Cost Has Been Entered for the Product

Selling Without Entering Initial Cost or Issuing a Purchase Order

If neither the initial cost nor a purchase order has been recorded, the product cost is set to zero, and the profit margin appears to be 100%. Description

If you notice the profit is incorrect, you can simply issue a purchase order to record the product cost, setting the purchase order date earlier than the sales order date; the product cost will then reflect the purchase price.

Issuing a Purchase Order to Record Product Inventory

Scenario 1: If a purchase order is issued and the unit price remains unchanged, the product cost equals the purchase price.

For example, if a product is set to a purchase price of 60 and three purchase orders are issued at that same price, the product cost will be 60. Description

Scenario 2: A purchase order is issued, and the unit price varies; in this case, the product cost is calculated using the moving weighted-average method.

For example, the first purchase order lists a unit price of 60 for 5 units, and the second lists a unit price of 50 for 5 units. The product cost is then calculated as: (Remaining initial inventory × Initial cost + Purchased inventory × Purchase price) / (Remaining initial inventory + Purchased inventory), which comes out to (60×5 + 50×5) / (5+5) = 55. Description

Initial Inventory Has Been Entered, but Initial Cost Has Not

Selling Directly Without Issuing a Purchase Order

If a product has initial inventory but no initial cost, and no purchase order has been issued to record the cost, the product cost is zero, resulting in a 100% gross margin on sales. Description

If you find the profit is off, you can directly adjust the product’s initial cost.

Issuing a Purchase Order with a Unit Price

If a product has initial inventory and a purchase order is issued, the moving weighted-average method is used to calculate the product cost.

For example, a product has an initial inventory of 10 units with an initial cost of zero, and then a purchase order is issued for 5 units at a purchase price of 60. The product cost is calculated as: (Remaining initial inventory × Initial cost + Purchased inventory × Purchase price) / (Remaining initial inventory + Purchased inventory), which comes out to (10×0 + 5×60) / (10+5) = 20. Description

Initial Cost Has Been Entered, but Initial Inventory Has Not

Scenario 1: The product has an initial cost but no inventory; in this case, negative‑inventory sales are priced at the initial cost.

For example, if the system allows negative‑inventory sales, and the product has no initial inventory nor a purchase order to replenish it, you can still issue a sales order. In this scenario, the unit cost of the sold items is the initial cost. Description

Scenario 2: A purchase order is issued to replenish the product’s inventory; in this case, the product cost equals the unit price on the purchase order.

For example, a product has an initial cost of 60 and zero inventory. A purchase order is issued for 10 units at a cost of 65, so the product cost becomes 65 (calculated using the moving weighted-average method). Description


  • If a product has zero or negative inventory and a purchase order is issued to replenish its stock, the product cost will be updated to match the unit price of the most recent purchase order, regardless of its previous cost.
  • The system only uses the moving weighted-average method for cost calculations and does not offer alternative algorithms.
  • To view changes in inventory costs, go to 【Inventory】– enter the item name – 【Cost Track】 to check.