Skip to content

Commit 1a9342a

Browse files
author
Allan Maia
authored
[CSE-15] Append PayPal and PayLater buttons HTML only after eligibility check (#37)
1 parent e58286a commit 1a9342a

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/paypal/ppcp_buttons/ppcpOnLoad.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,6 @@ export async function ppcpOnLoad(payment: IExpressPayPaypalCommercePlatformButto
3131
const paypalDivId = 'ppcp-express-payment';
3232
paypalDiv.id = paypalDivId;
3333
paypalDiv.className = `${paypalDivId}`;
34-
paypalDiv.appendChild(paypalButtonDiv);
35-
paypalDiv.appendChild(payLaterButtonDiv);
3634
const container = document.getElementById('express-payment-container');
3735
container?.appendChild(paypalDiv);
3836

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

6260
if(container) {
6361
if (paypalButton.isEligible()) {
62+
paypalDiv.appendChild(paypalButtonDiv);
6463
await paypalButton.render(`#${paypalButtonDivId}`);
6564
enableSection = true;
6665
}
6766

6867
if (payLaterButton.isEligible()) {
68+
paypalDiv.appendChild(payLaterButtonDiv);
6969
await payLaterButton.render(`#${payLaterButtonDivId}`);
7070
enableSection = true;
7171
}
72-
7372
}
7473

7574
if(enableSection) {

0 commit comments

Comments
 (0)