Automattic / woocommerce-payments

Accept payments via credit card. Manage transactions within WordPress.
https://wordpress.org/plugins/woocommerce-payments/
Other
173 stars 69 forks source link

Disable Express Pay Buttons when Account Payments Are Disabled #5519

Closed darcie closed 1 year ago

darcie commented 1 year ago

Describe the bug

When Payments to a WooCommerce Payments account are disabled due to missing information, the Express Pay buttons still appear on product pages, cart, and checkout. Customers receive an error upon attempting to checkout, as the account cannot receive payments.

It would be better to disable these buttons, as the credit card fields are already disabled.

To test this, I created a new test site, set up WooCommerce Payments, and ensured the Express Pay buttons appeared. I then swapped the accounts to one that had previously been restricted for lack of information and cleared the WC Pay cache to ensure the disabled account was the one connected. The buttons still appeared, but the card fields were disabled at checkout. I then completed onboarding the account but with fake data that couldn't be verified so payments were still disabled. The buttons still appeared.

To Reproduce

  1. Have a WooCommerce Payments account with disabled payments and deposits
  2. Enable Express Payments at WooCommerce > Settings > Payments > WooCommerce Payments
  3. Visit a product, cart or checkout page
  4. Confirm that the Express button appears
  5. Confirm that the credit card fields for checkout do not appear

Actual behavior

The buttons appear and indicate to customers that they can pay with Apple Pay or Google Pay, even though the merchant cannot take payments using WooCommerce Payments.

Screenshots

Screenshot 2023-02-03 at 6 21 09 PM Screenshot 2023-02-03 at 6 17 37 PM

Expected behavior

I expected the express buttons would be disabled if the site could not use WooCommerce Payments for transactions.

Additional context

Identified in 5926336-zen using WooCommerce Payments 5.4.0

daquinons commented 1 year ago

I believe this should be handled by @Automattic/heisenberg

bborman22 commented 1 year ago

@mdmoore this would actually tie in really nicely with the work in #5937, perhaps we could add a check on the account payments status before attaching the payment request display hooks?