-
Notifications
You must be signed in to change notification settings - Fork 2k
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
Checkout: Hide edit button when only one payment method exists #90345
base: trunk
Are you sure you want to change the base?
Conversation
Jetpack Cloud live (direct link)
Automattic for Agencies live (direct link)
|
Here is how your PR affects size of JS and CSS bundles shipped to the user's browser: Sections (~27 bytes added 📈 [gzipped])
Sections contain code specific for a given set of routes. Is downloaded and parsed only when a particular route is navigated to. Async-loaded Components (~27 bytes added 📈 [gzipped])
React components that are loaded lazily, when a certain part of UI is displayed for the first time. Legend What is parsed and gzip size?Parsed Size: Uncompressed size of the JS and CSS files. This much code needs to be parsed and stored in memory. Generated by performance advisor bot at iscalypsofastyet.com. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a good idea and the code looks good to me. However, I have one major concern:
Remember that the "Edit" button doesn't just allow changing the payment method, it also allows editing the options of the active payment method.
Each payment method can have an active and an inactive UI. In the case of the free credits payment method, they are the same. However, some payment methods have quite a different for each version. For example, the credit card payment method shows a credit card form in its active UI but not in its inactive UI. With this change, I think it would become impossible to edit the credit card info if that was the only payment method available.
You probably actually want to only hide the edit button if the inactive UI is identical to the active UI, but this may turn out to be very hard to do since comparing component output is not easy.
What happens if a payment method doesn't have an inactive UI at all? Does it re-use the active UI? I can't remember. If so, maybe you could just remove the inactive UI from the credits payment method and hide the edit button if there is no inactive UI.
That is a good point 🤔
It looks like if I wonder if it makes more sense to just explicitly set which payment methods should not show the edit button based on the ones we know show up by themselves? |
Yeah, that's one way to do it. Some sort of property on the payment method object maybe? Either that or the suggestion I made above: re-use the |
This is a follow up PR to #90240
In #90240 we added the credit amount to the
WordPressFreePurchaseSummary
component to make the amount more obvious.In this PR we are hiding the edit button for the Payment Method step if the step only contains one payment method - because editing a list of one isn't really possible.
Related to #88863
Proposed Changes
HeaderEditButton
for the Payment Method step when - 1) thepaymentMethodStepIsActive
2) thepaymentMethods
array has a length of 1 or lessTesting Instructions
Regular purchases
Credit purchases