Introduction

In inventory management, accurately tracking the cost of goods is critical for planning, pricing, and financial reporting. Apache OFBiz uses Weighted Average Cost (WAC) as the method to calculate the average inventory cost, accounting for variations in  prices and quantities across purchases.

This document explains how Weighted Average Cost works, how it differs from Simple Average Cost, and how to view WAC data in Apache OFBiz.


1. What is Weighted Average Cost?

The Weighted Average Cost function in Apache OFBiz calculates the cost of inventory by factoring in both the unit price and the quantity purchased. This method ensures that prices associated with larger quantities carry more influence in the final average.

WAC smooths out price fluctuations by blending multiple purchase costs based on quantity. This provides a stable and realistic cost for items, especially when prices vary over time.

Formula:

Weighted Average Cost = Σ (Received Quantity × Unit Price) / Σ Received Quantity

Example:

Purchase

Quantity

Unit Price

Total Cost

1

10

$5

$50

2

20

$7

$140

3

30

$9

$270

Calculation:

WAC = (50 + 140 + 270) ÷ (10 + 20 + 30) = 460 ÷ 60 = $7.67

Key point:

WAC reflects the true cost of inventory by assigning proportional value to each purchase based on quantity. It provides more accurate costing when prices are dynamic.

Purchase-wise Breakdown with WAC:

Purchase

Quantity

Unit Price

Total Cost

Weighted Avg Unit Cost

1

10

$5

$50

$5.00

2

20

$7

$140

$6.33 ← (50+140)/30

3

30

$9

$270

$7.67 ← (50+140+270)/60


2. Simple Average Cost Method

Definition:

Simple Average Cost calculates the average of all unit prices, without considering how many units were purchased.

Formula:

Simple Average Cost = Σ (Unit Price) / (Number of Receipts)

Example:

Purchase

Quantity

Unit Price

1

10

$5

2

20

$7

3

30

$9

Calculation:

Simple Average = (5 + 7 + 9) ÷ 3 = $7.00

Key Point:

Each price is weighted equally, regardless of how many units were bought. This often results in less accurate valuations when purchase volumes vary.

Purchase-wise Breakdown with Simple Avg:


Purchase

Quantity

Unit Price

Simple Avg Unit Cost

1

10

$5

$5.00

2

20

$7

$6.00 ← (5+7)/2

3

30

$9

$7.00 ← (5+7+9)/3


Weighted Average Cost vs. Simple Average

While both methods aim to estimate inventory cost, Weighted Average Cost offers a more accurate and consistent view, especially when purchase quantities vary. Unlike Simple Average Cost, WAC dynamically adjusts to pricing and volume changes, providing better alignment with real-world conditions.

3. Viewing Weighted Average Cost in Apache OFBiz

While Apache OFBiz doesn't display the Weighted Average Cost directly on the Product screen, you can get inventory WACs from the Facility application as follows:

  1. Navigate to Facility > Facilities.

  2. Select the desired Facility ID from the dropdown.

  3. Go to Inventory > Inventory Average Costs.

  4. Locate the product using its Product ID in the list.

The Weighted Average Cost for a product or item is automatically updated each time new stock is received in inventory, replacing the previous WAC value.

4. Current Limitation

As of now, the Inventory Average Costs screenlet in Apache OFBiz does not offer a search function for locating specific products. Users must manually scroll through the list to find a product. At the time of writing, a Jira ticket has already been created to address this limitation and simplify product search in Apache OFBiz.

5. Example: Weighted Average Cost for Sticker (STC1001) in Apache OFBiz

To demonstrate how Apache OFBiz calculates and updates the Weighted Average Cost, we will use the example of a sticker. We will receive multiple inventories at different costs and observe how the WAC changes after each receipt.

Step 1: Product Setup

The product Sticker (STC1001) has already been created in Apache OFBiz.
If you want to learn how to create a product in Apache OFBiz, refer to this guide.

Step 2: Check WAC.

  1. Navigate to Facility > Facilities.



  2. Select the Facility ID (i.e. Web Store Warehouse) from the dropdown.



  3. Go to Inventory > Inventory Average Costs.




Note: Product details will not be displayed until the inventory has been received at least once.

Step 3: Inventory Receipts

The process of receiving inventory in Apache OFBiz has been explained in detail in this post.

Here is how the Weighted Average Cost updates after each of the following three inventory receipts for the Sticker (STC1001):

R1 First Receipt 

    • Quantity: 100 units
    • Unit Price: $2.00
    • Total Cost: $200
    • WAC = $2.00

ProductAverageCost showing WAC = $2.00 after R1.

R2 Second Receipt

    • Quantity: 150 units
    • Unit Price: $3.00
    • Total Cost: $650
    • WAC: $2.60

Calculation:
Total Cost = 200 + 450 = 650
Total Quantity = 250
WAC = 650 ÷ 250 = $2.60

                     

ProductAverageCost showing WAC = $2.60 after R2.

R3 Third Receipt 

    • Quantity: 250 units
    • Unit Price: $4.00
  • Total Cost: $1650
  • WAC: $3.30

Calculation:
Total Cost = 200 + 450 + 1000 = 1650
Total Quantity = 500
WAC = 1650 ÷ 500 = $3.30

                   

ProductAverageCost showing WAC = $3.30 after R3.

Example Wrap-Up

Receipt

Quantity

Unit Price

Total Cost

Cumulative Quantity

Cumulative Cost

WAC

R1

100

$2

$200

100

$200

$2.00

R2

150

$3

$450

250

$650

$2.60

R3

250

$4

$1,000

500

$1,650

$3.30



Conclusion

This demo illustrates how Apache OFBiz automatically recalculates the Weighted Average Cost with each new inventory receipt. 

By blending costs across all receipts, WAC ensures that inventory valuation remains stable and realistic, even when purchase prices vary. This provides a more accurate cost base for pricing decisions, production runs, and financial reporting.