Cost Variance Detection & Weighted Average Cost (WAC)
Overview
WorkMate provides automated cost variance detection and Weighted Average Cost (WAC) calculation to ensure accurate inventory valuation and cost control. This feature enables merchants to track supplier costs, identify discrepancies, and update product cost basis in real time, ensuring finance and procurement teams have reliable insights.
Business Value
- Identify discrepancies between expected and invoiced supplier prices. 
- Maintain accurate product cost basis across multiple vendors. 
- Prevent margin erosion from untracked cost increases. 
- Provide finance and procurement with real-time cost insights. 
- Enable cost and variance reporting through Report Pundit. 
Key Concepts
1. Expected Cost (Static Reference)
- Stored on: Shopify Product Variant via metafield 
- Key: - workmate.expected_cost
- Type: Decimal 
- Purpose: Represents the initially expected cost per unit, used as the baseline for variance checks. 
2. Actual Cost (PO Line Item)
- Captured at: Time of PO invoicing or reception 
- Field: - actual_cost(per unit)
- Entry: Must be entered manually or synced from invoice data 
3. Cost Variance Detection
WorkMate automatically calculates cost variance when both expected_cost and actual_cost are present on a PO line item.
Formulas:
variance = actual_cost - expected_cost  
variance_percent = (variance / expected_cost) × 100Variance Flags:
- < 5%→ none
- 5–10%→ review
- > 10%→ high
Fields per PO Line Item:
- expected_cost(Decimal) – from variant metafield
- actual_cost(Decimal) – from PO line item
- variance(Decimal) – absolute difference
- variance_percent(Decimal) – percentage difference
- variance_flag(String) – none / review / high
4. Weighted Average Cost (WAC)
WorkMate automatically recalculates WAC every time inventory is received through a PO. This ensures future reporting and profitability analysis reflect the real average cost of goods.
Calculation Logic:
- Retrieve current - weighted_average_costfrom variant.
- Retrieve - quantity_on_handbefore receiving.
- Apply formula: 
New WAC = 
((Q_on_hand × C_current) + (Q_received × C_actual)) 
÷ (Q_on_hand + Q_received)Where:
- Q_on_hand: Current inventory quantity
- C_current: Current weighted average cost
- Q_received: Quantity received from PO
- C_actual: Actual cost per unit from PO
5. Data Exposure for Reporting
All cost and variance fields are structured for compatibility with Report Pundit.
Product Variant
expected_cost
Static reference cost
Product Variant
weighted_average_cost
Live average cost, updated per PO
PO Line Item
actual_cost
Per-unit cost from PO
PO Line Item
variance
Absolute cost difference
PO Line Item
variance_percent
% difference from expected
PO Line Item
variance_flag
none / review / high
Example: Weighted Average Cost Update
Scenario:
- Product: Bike Tire 
- Initial Inventory: 100 units 
- Current WAC: $20.00 per unit 
New Purchase Order Received:
- Quantity: 50 units 
- Actual Cost: $25.00 per unit 
Calculation:
New WAC = ((100 × 20) + (50 × 25)) ÷ (100 + 50)  
New WAC = (2000 + 1250) ÷ 150  
New WAC = 21.67Result:
- New Weighted Average Cost = $21.67 per unit 
Last updated