If you attempted to delete a token that was used by an active subscription, there was no default set and you used a block based checkout, you'd be faced with this empty error message.
The issue here was caused by the way we display this notice. We print an empty notice to the screen and hide it (WCS_My_Account_Payment_Methods::print_deleting_notices()). If the user clicks on one of the delete token buttons that we've altered to instead result in an error, we populate the empty notice with the correct error message and then show the notice.
The problem was that block based stores use a slightly different notice HTML and so populating the notice with the content didn't work.
This PR updates the JS code to make sure it can support block based notices format and old WC notices.
How to test this PR
WC 8.4+
Make sure you're running WC 8.5 and above.
Purchase a subscription using a saved token or add a new one.
Go to the My Account > Payment methods screen
Attempt to delete the token.
trunk You should see the blank notice above.
On this branch the notice should be populated with the correct content.
Fixes https://github.com/woocommerce/woocommerce-subscriptions/issues/4616
Description
If you attempted to delete a token that was used by an active subscription, there was no default set and you used a block based checkout, you'd be faced with this empty error message.
The issue here was caused by the way we display this notice. We print an empty notice to the screen and hide it (
WCS_My_Account_Payment_Methods::print_deleting_notices()
). If the user clicks on one of the delete token buttons that we've altered to instead result in an error, we populate the empty notice with the correct error message and then show the notice.The problem was that block based stores use a slightly different notice HTML and so populating the notice with the content didn't work.
This PR updates the JS code to make sure it can support block based notices format and old WC notices.
How to test this PR
WC 8.4+
trunk
You should see the blank notice above.trunk
WC 8.4
trunk
and this branch, the notice works fine.Product impact