Wocart

@wocart/storefront v3.1.0


@wocart/storefront / index / formatMoney

Function: formatMoney()

formatMoney(amount, options): string

Format money amount with locale-aware formatting.

Parameters

amount

number

Amount in the platform currency's smallest whole unit (DZD)

options

MoneyFormatOptions

Formatting options (symbol, locale, decimals)

Returns

string

Formatted money string

Example

TypeScriptCode
// Arabic: 5,000 دج (with Arabic-Indic digits) formatMoney(5000, { symbol: 'دج', locale: 'ar-DZ' }) // French: 5 000,00 DA formatMoney(5000, { symbol: 'DA', locale: 'fr-FR', decimals: 2 }) // English: 5,000 DA formatMoney(5000, { symbol: 'DA', locale: 'en-US' })

The symbol follows the amount in every language, as Algerian prices are written, joined by a no-break space so the two never wrap apart.