Product Rate Conversion
Converts product prices between currencies using configured exchange rates. Only activates when no direct price exists for the target currency.
Included in Crypto Preset
Registered automatically by registerCryptoPlugins() / registerAllPlugins().
Registration
import { pluginRegistry } from '@unchainedshop/core';
import { ProductPriceRateConversionPlugin } from '@unchainedshop/plugins/pricing/product-price-rateconversion';
pluginRegistry.register(ProductPriceRateConversionPlugin);
How It Works
- Checks if a price already exists in the calculation (skips if yes)
- Looks up a price in any available currency for the product
- Fetches the exchange rate between source and target currencies
- Converts and adds the price to the calculation
Prerequisites
- Exchange rates must be configured in the database
- Both source and target currencies must be active
Setting Exchange Rates
Use one of the built-in worker plugins to update rates automatically:
- Update ECB Rates - European Central Bank rates
- Update Coinbase Rates - Cryptocurrency rates
Or update rates programmatically:
await unchainedAPI.modules.products.prices.rates.updateRates([
{
baseCurrency: 'CHF',
quoteCurrency: 'EUR',
rate: 0.95,
timestamp: new Date(),
expiresAt: new Date(Date.now() + 24 * 60 * 60 * 1000),
},
]);
Adapter Details
| Property | Value |
|---|---|
| Key | shop.unchained.pricing.rate-conversion |
| Version | 1.0.0 |
| Order Index | 10 |
| Source | pricing/product-price-rateconversion |
Related
- Product Catalog Price - Base product pricing
- Multi-Currency Setup - Currency configuration guide