wp-calypso icon indicating copy to clipboard operation
wp-calypso copied to clipboard

Checkout: Hide edit button when only one payment method exists

Open jjchrisdiehl opened this issue 9 months ago • 5 comments

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

Before After
image image

Proposed Changes

  • Hide the stepper's HeaderEditButton for the Payment Method step when - 1) the paymentMethodStepIsActive 2) the paymentMethods array has a length of 1 or less

Testing Instructions

Regular purchases

  • Add a renewal to your shopping cart, ensure the cart has valid payment methods
  • Go to the Payment Method step and ensure that you see an edit link to change your payment method
  • Make sure you can change methods via the edit link

Credit purchases

  • Next, add enough credit to your account to cover the purchase completely
  • Refresh checkout and go to Payment method step, it should show WordPress.com Credits $x.xx
  • At this point there should not be an edit link next to the payment method step, but, there should be an edit link next to Billing Information
  • Try to find some combination that breaks this PR

jjchrisdiehl avatar May 07 '24 02:05 jjchrisdiehl