Skip to content

Commit

Permalink
Pay with PayPal: ensure proper price formatting (#37534)
Browse files Browse the repository at this point in the history
Fixes #14496

Follow-up from #37530

Conversation: p1716490240939649-slack-C05PV073SG3
  • Loading branch information
jeherve committed May 24, 2024
1 parent 623d749 commit 8924af1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,10 @@ class Jetpack_Currencies {
* @return string Formatted price.
*/
public static function format_price( $price, $currency, $symbol = true ) {
$price = (float) $price;
// Add some basic formatting for the price.
$formatted_number = new NumberFormatter( get_locale(), NumberFormatter::DECIMAL );
$price = (float) $formatted_number->parse( $price );

// Fall back to unspecified currency symbol like `¤1,234.05`.
// @link https://en.wikipedia.org/wiki/Currency_sign_(typography).
if ( ! array_key_exists( $currency, self::CURRENCIES ) ) {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: other

Pay with PayPal: ensure prices are correctly formatted.

0 comments on commit 8924af1

Please sign in to comment.