## Multi-Currency Conversion in Alpha Insights

Alpha Insights automatically handles multi-currency conversions across all your store data, ensuring accurate profit reporting regardless of which currencies you transact in.

### How Exchange Rates Are Fetched

Alpha Insights uses the Open Exchange Rates API to fetch current exchange rates automatically. This process happens in the background and keeps your currency conversions accurate and up-to-date.

### Where Currency Conversion Is Applied

Alpha Insights automatically converts currencies across all major data sources to your base currency (typically your store's default currency). This ensures all profit calculations, reports, and analytics are accurate and consistent.

#### 1. WooCommerce Orders

When processing order data, Alpha Insights converts all order values to your base currency:

- Order Revenue: Total order amount converted to base currency
- Product Costs: Cost of goods sold converted if stored in different currency
- Shipping Costs: Shipping charges converted to base currency
- Taxes: Tax amounts converted for accurate tax reporting
- Refunds: Refunded amounts converted using the original order's exchange rate
- Payment Gateway Fees: Transaction fees converted to base currency

##### Multi-Currency Plugin Integration

If your order contains multi-currency metadata from popular WooCommerce currency plugins, Alpha Insights will use the exchange rate that was actually applied to the customer at checkout. This ensures the most accurate conversion possible.

Recognized meta keys:

- `_wcpbc_base_exchange_rate` - WooCommerce Price Based on Country
- `_wpd_ai_exchange_rate` - Alpha Insights stored rate

Compatible plugins:

- WPML Multi-Currency
- WooCommerce Currency Switcher
- Multi-Currency for WooCommerce
- Aelia Currency Switcher
- WooCommerce Price Based on Country

If no currency metadata is found, Alpha Insights will use the current exchange rate from the API to convert the order amounts.

#### 2. Facebook Ad Spend Accounts

Facebook Ads Manager allows you to run campaigns in different currencies. Alpha Insights automatically detects the currency for each ad account and converts all metrics to your base currency:

- Daily Ad Spend: Campaign costs converted from account currency to base currency
- Purchase Values: Revenue attributed to Facebook ads converted to base currency
- Cost Per Click (CPC): Calculated using converted spend amounts
- Cost Per Acquisition (CPA): Calculated using converted spend amounts
- ROAS (Return on Ad Spend): Calculated with all values in base currency

Example: If your Facebook ad account runs campaigns in EUR but your store currency is USD, Alpha Insights will automatically convert all EUR spend amounts to USD using the current exchange rate before calculating your ROAS and profit metrics.

#### 3. Google Ad Spend Accounts

Similar to Facebook Ads, Google Ads accounts can operate in different currencies. Alpha Insights handles the conversion automatically:

- Campaign Costs: Google Ads spend converted from account currency (stored in micros) to base currency
- Conversion Values: Revenue attributed to Google Ads converted to base currency
- Cost Per Click (CPC): Calculated using converted amounts
- Cost Per Conversion: Calculated using converted spend amounts
- ROAS: Calculated with all values in base currency

Note: Google Ads API returns costs in "micros" (1/1,000,000 of the currency unit). Alpha Insights first converts micros to the standard currency format, then applies exchange rate conversion if the account currency differs from your base currency.

#### 4. Expenses

Expenses can be entered in any currency. Alpha Insights stores both the original currency and amount, then converts to your base currency for reporting:

- Manual Expenses: Enter amount in any currency, automatically converted for reports
- Recurring Expenses: Each occurrence converted at current exchange rate
- API-Generated Expenses: Facebook and Google ad expenses created with correct currency
- Supplier Invoices: Foreign currency invoices automatically converted

Original Currency Preservation: The original currency and amount are always stored, so you can reference the actual amount paid even after conversion.

### Conversion Accuracy

#### Historical Accuracy

Alpha Insights aims to use the most accurate exchange rate for each transaction:

- Order Date Rates: When possible, uses the exchange rate from the date the order was placed
- Stored Rates: If the order contains stored exchange rate metadata, that rate is used
- Current Rates: If no historical data is available, current rates are applied

#### Rounding and Precision

- Currency conversions are calculated to full precision
- Display values are rounded to 2 decimal places for currencies
- Exchange rates are stored with high precision (typically 6+ decimal places)

### Base Currency Selection

Your base currency is the currency used for all profit reports and analytics. This should be:

- Your primary operating currency
- The currency you use for accounting and tax purposes
- Typically your store's default WooCommerce currency

Important: Once you've collected data, avoid changing your base currency as it can affect historical comparisons and reporting accuracy.

### Manual Exchange Rates

If you prefer to use fixed exchange rates (for accounting purposes or during API outages), you can manually set rates:

1. Go to Alpha Insights → Settings → Currency → Exchange Rates
2. Click Edit next to the currency
3. Select Manual Rate
4. Enter your exchange rate
5. Click Save

Use cases for manual rates:

- Your accounting department requires specific monthly rates
- You have hedging contracts with fixed exchange rates
- API is temporarily unavailable
- You need to match rates used by your payment processor

### Viewing Current Exchange Rates

To see your current exchange rates:

1. Go to Alpha Insights → Settings → Currency
2. Click View Exchange Rates
3. See all active currencies, their rates, last update time, and source (Auto/Manual)

### Troubleshooting

#### Exchange Rates Not Updating

Possible causes:

- Missing or invalid API key
- WordPress cron not running properly
- Currency set to "Manual" mode
- API rate limit reached (free plans have limits)

Solution: Click "Update Rates Now" to manually refresh, or check your API key in settings.

#### Incorrect Conversion Amounts

Check:

- Exchange rate is reasonable (not 0 or extremely high)
- Correct base currency is selected
- Currency codes are correct (e.g., EUR not EU)

#### Missing Currency

If you need a currency that isn't listed:

1. Go to Manage Currencies
2. Click Add Currency
3. Select from 150+ supported currencies
4. Choose automatic or manual rate

### Best Practices

- Use automatic rates unless your accounting specifically requires manual rates
- Set base currency once and avoid changing it after collecting data
- Review rates monthly to ensure they're reasonable
- Document manual changes for audit and tax purposes
- Keep rate history for tax records and accounting reconciliation
- Test with sample orders in different currencies before going live

### Technical Details

#### Conversion Formula

Currency conversion uses the following formula:

    converted_amount = original_amount × (target_rate / source_rate)

Example: Converting €100 to USD with rates EUR=1.0950 and USD=1.0000:

    $109.50 = €100 × (1.0000 / 1.0950)

#### Core Functions

- `wpd_fetch_currency_exchange_rates_open_exchange()` - Fetches rates from API
- `wpd_convert_currency($from, $to, $amount)` - Converts amount between currencies
- `wpd_get_order_currency_conversion_rate($order)` - Gets rate for specific order
- `wpd_get_default_currency_conversion_rates()` - Returns cached rate table

### Support

For additional help with multi-currency setup or troubleshooting, use the contact support button on the left.