Skip to content
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

Fix the "0.00" amount in Google Pay for virtual products (3696) #2636

Merged
merged 4 commits into from
Oct 4, 2024

Conversation

stracker-phil
Copy link
Collaborator

Description

This PR addresses two issues with Google Pay:

  1. When shipping callback is disabled, the Google Pay sheet displayed the total amount of "0.00" instead of the actual product price.
  2. In Block Cart, certain plugin constellations led to transmitting the incorrect payment method ID for Google Pay

Details

Issue 1

  • It was only a "cosmetic" problem that was confusing for the customer, while the store did charge the correct amount during order processing.
  • The bug was caused by lack of shipping cost details, which resulted in shippingFee being set to NaN, which could not be used in an invalid total value that was rendered as "0.00"
  • Fixed by casting shipping fees to a number: 643a23c

Issue 2

  • Might be a bug in WooCommerce, and will be escalated. The current PR includes a workaround to ensure our plugin always sends the correct payment method on the Block Cart page
  • Note that the Google Pay payment from Block Cart currently only works when "Final confirmation on checkout" is enabled, as the express logic is not fully integrated in the Block system
  • Fixed using an internal WooCommerce dispatcher: c852bc9#diff-4031c86ec91715f38d15ad5de3c4cbed531cbc95e7b8e3326aaa9153faa376b8R82-R84

When shipping is disabled, the shippingFee is `undefined` which also resulted in the amount to become `NaN`
- Remove unused imports
- Use state instead of global window-variable (continuationFilled)
- Apply codestyle rules (spaces, change one let to const)
@InpsydeNiklas InpsydeNiklas added this to the 2.9.3 milestone Oct 3, 2024
@Dinamiko Dinamiko merged commit b4b574d into trunk Oct 4, 2024
9 checks passed
@Dinamiko Dinamiko deleted the PCP-3696-google-pay-has-no-amount branch October 4, 2024 13:15
@Dinamiko Dinamiko added the bug Something isn't working label Oct 10, 2024
@Dinamiko Dinamiko mentioned this pull request Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants