Repository navigation
fix: hide express checkout header when no wallet button is displayed - #285
Open
jakubjasinsky wants to merge 2 commits into
Open
jakubjasinsky wants to merge 2 commits into
jakubjasinsky wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The callback wiring and visibility changes match the intended behavior, with no unresolved blocking findings.
No open issues 🎉
What changed in this PR
This PR prevents Dynamic Checkout from showing an empty “Express checkout” section when configured wallets are unavailable, while preserving immediate display for saved payment methods.
Changes:
- Adds callbacks when Apple Pay or Google Pay displays its button.
- Keeps wallet-only express checkout sections hidden until a wallet button appears.
- Adds tests for wallet availability, readiness, and failure cases.
| File | Description |
|---|---|
test/dynamic-checkout/wallet-availability.test.ts |
Tests wallet button display callbacks across availability outcomes. |
src/dynamic-checkout/views/payment-methods.ts |
Hides wallet-only sections until a button is displayed. |
src/dynamic-checkout/payment-methods/google-pay.ts |
Passes the display callback to the Google Pay client. |
src/dynamic-checkout/payment-methods/apple-pay.ts |
Passes the display callback to the Apple Pay client. |
src/dynamic-checkout/clients/google-pay.ts |
Calls back after appending an available Google Pay button. |
src/dynamic-checkout/clients/apple-pay.ts |
Calls back after revealing an available Apple Pay button. |
Review effort: Balanced
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the only express checkout option is a wallet (Apple Pay / Google Pay) that turns out to be unavailable, Dynamic Checkout still rendered the "Express checkout" header above an empty section. The section now appears only once a wallet button is actually shown.
Changes
ApplePayClient/GooglePayClienttake anonButtonDisplayedcallback. It fires only when the button really renders (Apple PaycheckAvailabilitysucceeds, or Google PayisReadyToPayreturnsresult: true).DynamicCheckoutPaymentMethodsView: a section with only wallets starts hidden and is shown when any wallet calls back. If there are saved payment methods, the section shows straight away as before.wallet-availability.test.ts, covering Apple Pay available/unavailable and Google Pay ready / not ready / rejected.Impact
Additional Context
Known issues left for follow-ups:
#google-pay-button-containerkeeps its fixed 48px height when Google Pay is unavailable but Apple Pay is shown.