PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 2.2.0
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v2.2.0
2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 All 68 releases
better-payment / src / campaign-builder / utils / currency.js

currency.js in Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More 2.2.0, at src/campaign-builder/utils/currency.js

16 lines 587 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 /**
2 * Returns the currency symbol for the globally configured plugin currency.
3 * Reads from window.betterPaymentCampaignData.globalCurrency (localized by CPT.php).
4 * Falls back to '$' if unavailable or Intl is unsupported.
5 */
6 export function getGlobalCurrencySymbol() {
7 const currency = window?.betterPaymentCampaignData?.globalCurrency || 'USD';
8 try {
9 return new Intl.NumberFormat( 'en-US', { style: 'currency', currency } )
10 .formatToParts( 0 )
11 .find( ( p ) => p.type === 'currency' )?.value || '$';
12 } catch {
13 return '$';
14 }
15 }
16