Do not hide button on change payment page

This commit is contained in:
Alex P 2022-03-18 09:24:55 +02:00
parent 4fe5a63f42
commit f0ff7de9fa
3 changed files with 11 additions and 3 deletions

View file

@ -15,6 +15,7 @@ import {
PaymentMethods
} from "./modules/Helper/CheckoutMethodState";
import {hide, setVisible} from "./modules/Helper/Hiding";
import {isChangePaymentPage} from "./modules/Helper/Subscriptions";
const buttonsSpinner = new Spinner('.ppc-button-wrapper');
@ -108,7 +109,10 @@ document.addEventListener(
const hideOrderButtonIfPpcpGateway = () => {
// only in checkout and pay now page, otherwise it may break things (e.g. payment via product page),
// and also the loading spinner may look weird on other pages
if (!['checkout', 'pay-now'].includes(PayPalCommerceGateway.context)) {
if (
!['checkout', 'pay-now'].includes(PayPalCommerceGateway.context)
|| isChangePaymentPage()
) {
return;
}

View file

@ -1,4 +1,5 @@
import CheckoutBootstap from './CheckoutBootstap'
import {isChangePaymentPage} from "../Helper/Subscriptions";
class PayNowBootstrap extends CheckoutBootstap {
constructor(gateway, renderer, messages, spinner) {
@ -6,8 +7,7 @@ class PayNowBootstrap extends CheckoutBootstap {
}
updateUi() {
const urlParams = new URLSearchParams(window.location.search)
if (urlParams.has('change_payment_method')) {
if (isChangePaymentPage()) {
return
}

View file

@ -0,0 +1,4 @@
export const isChangePaymentPage = () => {
const urlParams = new URLSearchParams(window.location.search)
return urlParams.has('change_payment_method');
}