Add googlepay button to pay for order page

This commit is contained in:
Emili Castells Guasch 2024-07-17 15:16:58 +02:00
parent 34cbd05349
commit 40805c1a13
2 changed files with 17 additions and 4 deletions

View file

@ -62,7 +62,10 @@ class GooglepayButton {
)
.then( ( response ) => {
if ( response.result ) {
if ( this.context === 'checkout' ) {
if (
this.context === 'checkout' ||
this.context === 'pay-now'
) {
const wrapper = document.getElementById(
'ppc-button-ppcp-googlepay'
);

View file

@ -187,9 +187,19 @@ class GooglepayModule implements ModuleInterface {
}
);
add_action('woocommerce_review_order_after_submit', function () {
echo '<div id="ppc-button-' . esc_attr( GooglePayGateway::ID ) . '"></div>';
});
add_action(
'woocommerce_review_order_after_submit',
function () {
echo '<div id="ppc-button-' . esc_attr( GooglePayGateway::ID ) . '"></div>';
}
);
add_action(
'woocommerce_pay_order_after_submit',
function () {
echo '<div id="ppc-button-' . esc_attr( GooglePayGateway::ID ) . '"></div>';
}
);
}
/**