Skip to content

Commit

Permalink
leverage bnpl availability flag to stop PMME init for classic cart an…
Browse files Browse the repository at this point in the history
…d product page
  • Loading branch information
timur27 committed Feb 21, 2025
1 parent 4e85a82 commit 241fd87
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions client/product-details/bnpl-site-messaging/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,21 +57,23 @@ export const initializeBnplSiteMessaging = async () => {
isBnplAvailable,
} = window.wcpayStripeSiteMessaging;

let amount;
let elementLocation = 'bnplProductPage';
const paymentMessageContainer = document.getElementById(
'payment-method-message'
);

if ( ! isBnplAvailable ) {
paymentMessageContainer.style.setProperty( 'display', 'none' );
return;
}

let amount;
let elementLocation = 'bnplProductPage';

if ( isCart ) {
amount = parseInt( cartTotal, 10 ) || 0;
elementLocation = 'bnplClassicCart';
} else {
amount = parseInt( productVariations.base_product.amount, 10 ) || 0;

if ( ! isBnplAvailable ) {
paymentMessageContainer.style.setProperty( 'display', 'none' );
}
}

const api = new WCPayAPI(
Expand Down

0 comments on commit 241fd87

Please sign in to comment.