🐛 Fix issue with missing button in checkout

When the separate “Google Pay gateway” is disabled, the Google Pay button should be rendered inside the “PayPal gateway” container.
This commit is contained in:
Philipp Stracker 2024-08-13 12:26:44 +02:00
parent d9a0c6e19a
commit 2944ecc786
No known key found for this signature in database

View file

@ -3,6 +3,7 @@ import { apmButtonsInit } from '../Helper/ApmButtons';
import {
getCurrentPaymentMethod,
PaymentContext,
PaymentMethods,
} from '../Helper/CheckoutMethodState';
import {
ButtonEvents,
@ -673,6 +674,10 @@ export default class PaymentButton {
// Events relevant for buttons inside a payment gateway.
if ( PaymentContext.Gateways.includes( this.context ) ) {
const parentMethod = this.isSeparateGateway
? this.methodId
: PaymentMethods.PAYPAL;
// Hide the button right after the user selected _any_ gateway.
observeButtonEvent( {
event: ButtonEvents.INVALIDATE,
@ -682,7 +687,7 @@ export default class PaymentButton {
// Show the button (again) when the user selected the current gateway.
observeButtonEvent( {
event: ButtonEvents.RENDER,
paymentMethod: this.methodId,
paymentMethod: parentMethod,
callback: () => ( this.isVisible = true ),
} );
}