Currency Conversion: Dynamic Pricing for Global Markets

This article explains how we display prices in multiple currencies based on user location and preference.

The Problem: Global Pricing

Users from different countries expect prices in their local currency:

  • India: ₹ (INR)

  • USA: $ (USD)

  • Europe: € (EUR)

  • UK: £ (GBP)

  • Japan: ¥ (JPY)

Prices shown only in INR confuse international customers.

Detection Strategy

We detect currency preference from:

1. URL parameter (?curr=USD)

2. Session (stored after first detection)

3. Cookie (currency)

4. Country detection (from IP geolocation)

5. Default (INR)

Supported Currencies

We support 10 major currencies:

  • INR (Indian Rupee) - ₹

  • USD (US Dollar) - $

  • EUR (Euro) - €

  • GBP (British Pound) - £

  • JPY (Japanese Yen) - ¥

  • AUD (Australian Dollar) - A$

  • CAD (Canadian Dollar) - C$

  • SGD (Singapore Dollar) - S$

  • AED (UAE Dirham) - د.إ

  • SAR (Saudi Riyal) - ﷼

Currency Switching

Users can switch currency via:

URL parameter: /p/Treo-N100?curr=USD

Currency selector: Dropdown in navigation

Automatic detection: Based on IP country

Conversion Process

Base Price (INR)

All products have a base price in INR:

base_price = get_the_price(sku)  # Returns INR price

Real-Time Conversion

Prices are converted using live exchange rates:

local_price = convert_the_amount(base_price, "INR", user_currency)

Exchange rates are updated daily from an external API.

Rounding

Converted prices are rounded to the nearest 100:

Example: $1,234.56 → $1,200

Benefit: Cleaner pricing, easier comparison

Display Format

Prices are displayed with the currency symbol and regional formatting:

INR: ₹1,23,456 (Indian grouping)

USD: $1,234 (Western grouping)

EUR: €1.234 (European grouping)

JPY: ¥123,456 (no decimals)

Conditional Pricing Display

Prices are shown only in specific contexts:

Google Shopping Traffic

Users from Google Shopping see prices:

Benefit: Compliance with Google Shopping requirements

Regular Traffic

Regular users do not see prices by default:

Reason: B2B focus, quote-based pricing

Exception: Users can enable pricing via currency selector

Cart Currency

The cart stores its currency at creation:

Field: Currency (default: INR)

Locked: Currency is locked when the cart is created

Conversion: All items are converted to the cart currency

Benefit: Consistent pricing throughout checkout

Payment Currency

Payments are processed in the cart currency:

Razorpay: Supports INR, USD, EUR, GBP

Other currencies: Converted to INR for payment

Display: Both the cart currency and the INR equivalent are shown

Price Caching

Converted prices are cached to reduce API calls:

Cache key: {sku}_{currency}_{date}

TTL: 24 hours

Invalidation: Daily at midnight

Benefit: Fast page loads, reduced API costs

References

Related Articles

Summary

Currency conversion enables global pricing:

Detection:

  • URL parameter (?curr=USD)

  • Session (during browsing)

  • Cookie (30 days)

  • Country detection (from IP)

  • Default (INR)

Supported:

  • 10 major currencies

  • Real-time exchange rates

  • Regional formatting

  • Rounding to nearest 100

Conditional display:

  • Google Shopping traffic (always show)

  • Regular traffic (opt-in via selector)

Cart handling:

  • Currency locked at cart creation

  • All items in the same currency

  • Consistent through checkout

This gives international customers a consistent shopping experience.


← Back to Documentation Index