Show googlepay button conditionally

This commit is contained in:
Emili Castells Guasch 2024-07-16 16:45:32 +02:00
parent 895cd5c4c1
commit c941430b7d
4 changed files with 9 additions and 2 deletions

View file

@ -232,6 +232,8 @@ class CheckoutBootstap {
}
}
setVisible( '#ppc-button-ppcp-googlepay', isGooglePayMethod );
jQuery( document.body ).trigger( 'ppcp_checkout_rendered' );
}

View file

@ -13,3 +13,7 @@
min-width: 0 !important;
}
}
#ppc-button-ppcp-googlepay {
display: none;
}

View file

@ -27,7 +27,7 @@ class GooglepayButton {
this.log = function () {
if ( this.buttonConfig.is_debug ) {
console.log( '[GooglePayButton]', ...arguments );
//console.log('[GooglePayButton]', ...arguments);
}
};
}
@ -70,6 +70,7 @@ class GooglepayButton {
if ( wrapper ) {
const { ppcpStyle, buttonStyle } =
this.contextConfig();
wrapper.className = `ppcp-button-${ ppcpStyle.shape }`;
if ( ppcpStyle.height ) {

View file

@ -188,7 +188,7 @@ class GooglepayModule implements ModuleInterface {
);
add_action('woocommerce_review_order_after_submit', function () {
echo '<div id="ppc-button-' . esc_attr( GooglePayGateway::ID ) . '">Google Pay...</div>';
echo '<div id="ppc-button-' . esc_attr( GooglePayGateway::ID ) . '"></div>';
});
}