Skip to content

Commit 5cc6540

Browse files
committed
remove cart block checks from the script which is never run for cart block
1 parent 94dd750 commit 5cc6540

File tree

2 files changed

+40
-29
lines changed

2 files changed

+40
-29
lines changed

assets/css/admin.rtl.css

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@
6767
background-image: url( '../images/cards/visa.svg' );
6868
}
6969

70+
.payment-method__brand--alipay {
71+
background-image: url( '../images/payment-methods/alipay-logo.svg' );
72+
}
73+
7074
.payment-method__brand--cartes_bancaires {
7175
background-image: url( '../images/cards/cartes_bancaires.svg' );
7276
}
@@ -135,6 +139,14 @@
135139
background-image: url( '../images/payment-methods/klarna.svg' );
136140
}
137141

142+
.payment-method__brand--grabpay {
143+
background-image: url( '../images/payment-methods/grabpay.svg' );
144+
}
145+
146+
.payment-method__brand--wechat_pay {
147+
background-image: url( '../images/payment-methods/wechat-pay.svg' );
148+
}
149+
138150
.wc_gateways tr[data-gateway_id='woocommerce_payments'] .payment-method__icon {
139151
border: 1px solid #ddd;
140152
border-radius: 2px;

client/product-details/bnpl-site-messaging/index.js

Lines changed: 28 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -53,18 +53,21 @@ export const initializeBnplSiteMessaging = async () => {
5353
paymentMethods,
5454
currencyCode,
5555
isCart,
56-
isCartBlock,
5756
cartTotal,
5857
isBnplAvailable,
5958
} = window.wcpayStripeSiteMessaging;
6059

60+
// if ( ! isBnplAvailable ) {
61+
// return;
62+
// }
63+
6164
let amount;
6265
let elementLocation = 'bnplProductPage';
6366
const paymentMessageContainer = document.getElementById(
6467
'payment-method-message'
6568
);
6669

67-
if ( isCart || isCartBlock ) {
70+
if ( isCart ) {
6871
amount = parseInt( cartTotal, 10 ) || 0;
6972
elementLocation = 'bnplClassicCart';
7073
} else {
@@ -75,37 +78,33 @@ export const initializeBnplSiteMessaging = async () => {
7578
}
7679
}
7780

78-
let paymentMessageElement;
79-
80-
if ( ! isCartBlock ) {
81-
const api = new WCPayAPI(
82-
{
83-
publishableKey: publishableKey,
84-
accountId: accountId,
85-
locale: locale,
86-
},
87-
apiRequest
88-
);
81+
const api = new WCPayAPI(
82+
{
83+
publishableKey: publishableKey,
84+
accountId: accountId,
85+
locale: locale,
86+
},
87+
apiRequest
88+
);
8989

90-
const options = {
91-
amount: amount,
92-
currency: currencyCode || 'USD',
93-
paymentMethodTypes: paymentMethods || [],
94-
countryCode: country, // Customer's country or base country of the store.
95-
};
90+
const options = {
91+
amount: amount,
92+
currency: currencyCode || 'USD',
93+
paymentMethodTypes: paymentMethods || [],
94+
countryCode: country, // Customer's country or base country of the store.
95+
};
9696

97-
const elementsOptions = {
98-
appearance: await initializeAppearance( api, elementLocation ),
99-
fonts: getFontRulesFromPage(),
100-
};
97+
const elementsOptions = {
98+
appearance: await initializeAppearance( api, elementLocation ),
99+
fonts: getFontRulesFromPage(),
100+
};
101101

102-
const stripe = await api.getStripe();
102+
const stripe = await api.getStripe();
103103

104-
paymentMessageElement = stripe
105-
.elements( elementsOptions )
106-
.create( 'paymentMethodMessaging', options );
107-
paymentMessageElement.mount( '#payment-method-message' );
108-
}
104+
const paymentMessageElement = stripe
105+
.elements( elementsOptions )
106+
.create( 'paymentMethodMessaging', options );
107+
paymentMessageElement.mount( '#payment-method-message' );
109108

110109
// This function converts relative units (rem/em) to pixels based on the current font size.
111110
function convertToPixels( value, baseFontSize ) {

0 commit comments

Comments
 (0)