@@ -53,18 +53,21 @@ export const initializeBnplSiteMessaging = async () => {
53
53
paymentMethods,
54
54
currencyCode,
55
55
isCart,
56
- isCartBlock,
57
56
cartTotal,
58
57
isBnplAvailable,
59
58
} = window . wcpayStripeSiteMessaging ;
60
59
60
+ // if ( ! isBnplAvailable ) {
61
+ // return;
62
+ // }
63
+
61
64
let amount ;
62
65
let elementLocation = 'bnplProductPage' ;
63
66
const paymentMessageContainer = document . getElementById (
64
67
'payment-method-message'
65
68
) ;
66
69
67
- if ( isCart || isCartBlock ) {
70
+ if ( isCart ) {
68
71
amount = parseInt ( cartTotal , 10 ) || 0 ;
69
72
elementLocation = 'bnplClassicCart' ;
70
73
} else {
@@ -75,37 +78,33 @@ export const initializeBnplSiteMessaging = async () => {
75
78
}
76
79
}
77
80
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
+ ) ;
89
89
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
+ } ;
96
96
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
+ } ;
101
101
102
- const stripe = await api . getStripe ( ) ;
102
+ const stripe = await api . getStripe ( ) ;
103
103
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' ) ;
109
108
110
109
// This function converts relative units (rem/em) to pixels based on the current font size.
111
110
function convertToPixels ( value , baseFontSize ) {
0 commit comments