I tried the codes above, it doesnt work, so I modified it. This one works for me
document.getElementsByClassName("alt-payment-list-container").style.display = "none";
document.getElementsByClassName("alternative-payment-separator").style.display = "none";
Thank you very much miloman18
The code used to work for me for a couple of years and it has recently stopped working and the Paypal button has reappeared (along with Apple and Google Pay).
Has Shopify made changes to circumvent the above fix?
Are there any other solutions at present or new code?