Skip to content

Commit

Permalink
[CSE-15] Append PayPal and PayLater buttons HTML only after eligibili…
Browse files Browse the repository at this point in the history
…ty check
  • Loading branch information
allanmfx committed Aug 8, 2024
1 parent e58286a commit 0aba4b8
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/paypal/ppcp_buttons/ppcpOnLoad.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ export async function ppcpOnLoad(payment: IExpressPayPaypalCommercePlatformButto
const paypalDivId = 'ppcp-express-payment';
paypalDiv.id = paypalDivId;
paypalDiv.className = `${paypalDivId}`;
paypalDiv.appendChild(paypalButtonDiv);
paypalDiv.appendChild(payLaterButtonDiv);
const container = document.getElementById('express-payment-container');
container?.appendChild(paypalDiv);

Expand Down Expand Up @@ -61,15 +59,16 @@ export async function ppcpOnLoad(payment: IExpressPayPaypalCommercePlatformButto

if(container) {
if (paypalButton.isEligible()) {
paypalDiv.appendChild(paypalButtonDiv);
await paypalButton.render(`#${paypalButtonDivId}`);
enableSection = true;
}

if (payLaterButton.isEligible()) {
paypalDiv.appendChild(payLaterButtonDiv);
await payLaterButton.render(`#${payLaterButtonDivId}`);
enableSection = true;
}

}

if(enableSection) {
Expand Down

0 comments on commit 0aba4b8

Please sign in to comment.