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)

Showing only INR prices confuses 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 base price in INR:

base_price = get_the_price(sku)  # Returns INR price

Real-Time Conversion

Prices converted using live exchange rates:

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

Exchange rates updated daily from external API.

Rounding

Converted prices rounded to nearest 100:

Example: $1,234.56 → $1,200

Benefit: Cleaner pricing, easier comparison

Display Format

Prices displayed with currency symbol and 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 shown only in specific contexts:

Google Shopping Traffic

Users from Google Shopping see prices:

Detection: gclid, gbraid, or wbraid in URL

Cookie: show_pricing=1 (set for session)

Benefit: Comply with Google Shopping requirements

Regular Traffic

Regular users don't see prices by default:

Reason: B2B focus, quote-based pricing

Exception: Users can enable pricing via currency selector

Cart Currency

Cart stores currency at creation:

Field: Currency (default: INR)

Locked: Currency locked when cart created

Conversion: All items converted to cart currency

Benefit: Consistent pricing throughout checkout

Payment Currency

Payments processed in cart currency:

Razorpay: Supports INR, USD, EUR, GBP

Other currencies: Converted to INR for payment

Display: Shows both cart currency and INR equivalent

Price Caching

Converted prices 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 same currency

  • Consistent through checkout

This enables seamless international shopping experience.


← Back to Documentation Index