-
Notifications
You must be signed in to change notification settings - Fork 59
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the Bug
When using conditional visibility for express payment buttons, the GooglePay option fails to reinit.
Not entirely sure if related but I also see some console errors:
The issue was identified after some testing we did with the Conditional Shipping and Payments extension, but I simplified the replication steps into a snippet. Let me know if this helps!
Important: I'm working on dev mode.
To Reproduce
Prerequisites
Install the following JS code and ensure it loads on the Checkout page:
import { registerPaymentMethodExtensionCallbacks } from '@woocommerce/blocks-registry';
// ...
registerPaymentMethodExtensionCallbacks(
'woocommerce-ppcp-googlepay-test',
(() => {
const callbacksConfig = {};
callbacksConfig['ppcp-googlepay'] = (args) => {
const currentPostCode = args?.billingData?.postcode;
if ( currentPostCode === '92440' ) {
return false;
}
return true;
};
return callbacksConfig;
})()
);- Set up the snippet above.
- Make sure you've enabled Google Pay.
- Visit the checkout and change your address using the restricted postcode provided in the snippet above, e.g., 92440.
- Observe that the Google Pay button gets hidden as expected.
- Change the postcode to a valid one.
- Notice that the Google Pay button fails to appear again.
Screenshots
pp-googlepay-issue.mov
Expected Behavior
Google Pay express payment method should revalidate and appear once the conditions are met.
Actual Behavior
Environment
- WordPress Version
- WooCommerce Version
- Plugin Version
- Browser [e.g. Chrome, Safari] and Version
- Any other plugins installed
Additional Details
System status
<!--If applicable, paste the system status here. Please ensure you redact or remove any identifying information. -->
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working