## What Happens When I Update Costs?

When you update product costs, expenses, or fee settings, Alpha Insights automatically recalculates profit for all affected orders. This guide explains the recalculation process and what to expect.

### Automatic Recalculation

#### What Triggers Recalculation

Profit recalculates automatically when you:

- Update product cost
- Add or edit expenses
- Change payment gateway fee settings
- Modify shipping cost rules
- Add custom order costs

#### How It Works

1. You save a cost change
2. Alpha Insights queues background task
3. System finds all affected orders
4. Recalculates profit for each order
5. Updates database with new values
6. Reports automatically show updated data

#### Processing Time

Small stores (< 1,000 orders):10-30 seconds

Medium stores (1,000-10,000 orders):1-5 minutes

Large stores (10,000+ orders):5-30 minutes

Note: Happens in background - you can continue working

### Recalculation Examples

#### Example 1: Update Product Cost

Scenario:

- Product: Blue T-Shirt
- Old cost: $20
- New cost: $25
- Historical orders: 150

What happens:

1. All 150 historical orders recalculate
2. Each order profit reduced by $5
3. Total profit for that product reduced by $750
4. Reports update to show new profit figures

Timeline: Complete in 1-2 minutes

#### Example 2: Add Monthly Expense

Scenario:

- Add rent expense: $3,000/month starting Jan 1
- Current date: Jan 15
- Orders in January so far: 120

What happens:

1. $3,000 divided by 120 orders = $25 per order
2. Each January order profit reduced by $25
3. Net profit for January updated

Note: Only affects orders from expense start date forward

#### Example 3: Change Payment Fee Settings

Scenario:

- Update Stripe fee: 2.9% → 2.6% (negotiated better rate)
- Historical orders: All orders using Stripe

What happens:

1. All Stripe orders recalculate with new fee
2. Fees slightly lower
3. Profit increases slightly for each order

Processing: May take 5-15 minutes for large order history

### Historical vs Future Impact

#### Future Orders

New orders use current costs:

- Order placed today uses today's product cost
- No retroactive application
- Clean and simple

#### Historical Orders

Important decision: Should historical orders use new costs?

Alpha Insights default: Yes - recalculates all historical orders

Why:

- Gives you consistent reporting
- Shows "what-if" scenarios
- Easier to maintain single cost per product

Alternative approach: Use date-specific costs (advanced)

### Date-Specific Costs (Advanced)

#### When to Use

- Supplier changed prices at specific date
- You want historical accuracy
- Different costs in different time periods

#### How to Set

1. Edit product
2. Go to Alpha Insights Cost Settings
3. Enable Historical Cost Tracking
4. - Jan 1 - May 31: $20
   - Jun 1 - Dec 31: $23
5. Save

Result:

- Orders Jan-May use $20 cost
- Orders Jun-Dec use $23 cost
- Historical accuracy preserved

### Viewing Recalculation Status

#### Background Process Monitor

1. Go to Alpha Insights → Tools → Background Tasks
2. See active recalculation tasks
3. Progress bar shows completion %

#### Notification

When recalculation completes:

- Admin notice appears: "Profit recalculation complete"
- Shows number of orders updated

### Verifying Recalculation

#### Check Updated Profit

1. Go to Dashboard
2. Verify profit metrics changed as expected
3. Check a recent order's profit breakdown

#### Before/After Comparison

1. Before updating costs, note current profit
2. Update costs
3. After recalculation, compare profit
4. Verify change matches expectations

#### Test with Sample Order

1. Note profit for specific order
2. Update product cost
3. Check same order again
4. Verify profit updated correctly

### Common Questions

#### Q: If I update cost, can I undo it?

A: Yes, just update back to previous cost. Profit will recalculate again.

#### Q: Does recalculation slow my site?

A: No, runs in background with low priority. Site performance unaffected.

#### Q: What if I add costs months after orders?

A: Works fine! Historical orders will calculate profit using the cost you enter.

#### Q: Can I see profit before and after cost change?

A: Not automatically, but you can:

- Export reports before making changes
- Make changes
- Compare old export to new reports

### Best Practices

#### Before Major Cost Updates

1. Export current profit reports as backup
2. Document reason for cost change
3. Update costs
4. Verify new profit figures make sense

#### Supplier Price Increases

When supplier raises prices:

1. Update product costs with new values
2. Note effective date in product
3. Consider whether to raise selling prices
4. Monitor impact on margins

#### Correcting Errors

If you entered wrong cost:

- Simply update to correct cost
- Recalculation fixes all historical data
- No need to delete and re-enter orders

### Bulk Cost Updates

#### Updating Many Products

If supplier raised all costs by 10%:

1. Go to Cost of Goods Manager
2. Select all products (or filter to supplier)
3. Bulk Actions → Adjust Costs by Percentage
4. Enter +10%
5. Apply
6. All products update, all orders recalculate

#### Category-Wide Updates

1. Filter to specific category
2. Select all in category
3. Bulk update costs

### Monitoring Impact of Cost Changes

#### Before/After Report

1. Create comparison report
2. Date range: Same period
3. Compare profit before and after cost updates
4. See total impact

#### Margin Analysis

After updating costs:

1. Check profit margin % metric
2. Compare to previous margin
3. Assess if selling prices need adjustment