Skip to content

Fix wrong price formatting in Apple/Google Pay #4480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Jul 16, 2025

Conversation

Mayisha
Copy link
Contributor

@Mayisha Mayisha commented Jul 10, 2025

Fixes STRIPE-573
Fixes #4479

Changes proposed in this Pull Request:

  • Returning Stripe's expected currency decimal value in currency_decimals instead of what's saved in the WooCommerce settings.

Testing instructions

  • Go to WooCommerce > Settings > General and scroll to Currency options
  • Set USD as the store currency
  • Set 0 as the Number of decimals
  • Enable express checkout in your Stripe settings page
  • As a shopper, add a product priced $18 to your cart and go to the checkout page.
    • In develop, notice that Google/Apple Pay is not present
    • In this branch the Google/Apple Pay button should be present
  • Go to your cart and increase the number of products to 5 so that the cart total becomes $90.
    • In develop, notice that, Google/Apple Pay is now present on the checkout page. But when you click the express checkout button, notice that the displayed price is wrong.
    • In this branch, the Google/Apple pay button should be present and display the correct amount.
  • Now set the store currency to JPY and confirm that the price is correct on Google/Apple Pay and Link modals for JPY.

@Mayisha Mayisha changed the title Fix/decimal express methods Fix wrong price formatting in Apple/Google Pay Jul 10, 2025
@Mayisha Mayisha requested review from a team, malithsen and wjrosa and removed request for a team July 14, 2025 06:54
Copy link
Contributor

@wjrosa wjrosa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Left some optional comments. It works as expected, but when I attempt to add a product slightly cheaper than the $18 amount (the mocked beanie product with discount) I get the error below in console and the buttons are not present:

Screenshot 2025-07-14 at 10 42 03

Not directly related I guess, but might be worth fixing it if that's something simple to do here.

@Mayisha Mayisha requested a review from malithsen July 16, 2025 09:42
Copy link
Contributor

@malithsen malithsen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks Mayisha, this looks good to me 🚢

@Mayisha Mayisha merged commit 9998d99 into develop Jul 16, 2025
53 checks passed
@Mayisha Mayisha deleted the fix/decimal-express-methods branch July 16, 2025 15:15
Copy link

📈 PHP Unit Code Coverage Report

Package Line Rate Health
includes/class-wc-stripe-helper.php 61%
includes/payment-methods/class-wc-stripe-express-checkout-helper.php 23%
Summary 45% (7607 / 16991)

@malithsen malithsen added this to the 9.7.0 milestone Jul 16, 2025
malithsen pushed a commit that referenced this pull request Jul 17, 2025
* make 'three_decimal_currencies' method public

* use currency decimal supported in Stripe

* add changelog

* remove unnecessary else

* convert currency to lower case

* add test for test_get_stripe_currency_decimals
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong price formatting in Apple/Google Pay
3 participants