mirror of
https://github.com/woocommerce/woocommerce-paypal-payments.git
synced 2025-09-05 08:59:14 +08:00
🐛 Fix button insertion logic in block checkout
The Google Pay button was inserted into the wrong DOM wrapper
This commit is contained in:
parent
e9c557a361
commit
7f3636348b
2 changed files with 9 additions and 9 deletions
|
@ -659,8 +659,7 @@ export default class PaymentButton {
|
|||
const wrapper = this.wrapperElement;
|
||||
|
||||
if ( this.#button ) {
|
||||
this.log( 'addButton.removePrevious', this.#button );
|
||||
wrapper.removeChild( this.#button );
|
||||
this.removeButton();
|
||||
}
|
||||
|
||||
this.#button = button;
|
||||
|
@ -671,17 +670,18 @@ export default class PaymentButton {
|
|||
* Removes the payment button from the DOM.
|
||||
*/
|
||||
removeButton() {
|
||||
if ( ! this.isPresent ) {
|
||||
if ( ! this.isPresent || ! this.#button ) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.log( 'removeButton' );
|
||||
|
||||
if ( this.#button ) {
|
||||
const wrapper = this.wrapperElement;
|
||||
wrapper.removeChild( this.#button );
|
||||
|
||||
this.#button = null;
|
||||
try {
|
||||
this.wrapperElement.removeChild( this.#button );
|
||||
} catch ( Exception ) {
|
||||
// Ignore this.
|
||||
}
|
||||
|
||||
this.#button = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class GooglepayButton extends PaymentButton {
|
|||
buttonConfig.button.wrapper,
|
||||
buttonConfig.button.mini_cart_wrapper,
|
||||
ppcpConfig.button.wrapper,
|
||||
'express-payment-method-ppcp-googlepay',
|
||||
'ppc-button-googlepay-container',
|
||||
'ppc-button-ppcp-googlepay'
|
||||
);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue