I need to disable the Debit or Credit Card button from PayPal in WHCMS. I have used Stripe for credit card option, so it confuses my customers. Can anyone suggest the solution for this? screenshot
3 Answers
To disable the black Debit or Credit Card button, add &disable-funding=card
to the src
of the <script>
that loads the PayPal JS SDK on that checkout page.
So, for example:
<script src="https://www.paypal.com/sdk/js?client-id=test¤cy=USD&disable-funding=card"></script>
You can test this in the demo at: https://developer.paypal.com/demo/checkout/#/pattern/server
-
I want to remove that black button from PayPal payment option in WHMCS which means only need to display PayPal Checkout button itself no need for guest option and I have attached the screenshot. Kindly, check it Apr 19, 2022 at 4:12
-
-
Yeah, I knew this option but is applicable to web hosting server like WHMCS. Apr 19, 2022 at 4:32
-
Applies to any integration using that button. If you don't have control over the server/page being rendered, you'll need to ask whoever does. Apr 19, 2022 at 4:36
Add disable-funding=credit,card
to the src of the script.
example:
<script src="https://www.paypal.com/sdk/js?client-id=test&components=buttons,marks&disable-funding=credit,card"></script>
I created a hook that removes the .express-checkout-buttons
element on the Cart. It is not ideal and also removes the "default" PayPal checkout button. To implement the same solution create a file called DisableExpressCheckout.php
in whmcs\includes\hooks
and put the following content in it:
<?php
add_hook('ShoppingCartViewCartOutput', 1, function() {
$HTML = "<script>
window.addEventListener('load', function () {
const elements = document.getElementsByClassName('express-checkout-buttons');
if (elements) {
elements[0].remove();
}
});
</script>";
return $HTML;
});
The above script will create a script element on the cart page that will wait for the entire page to load and then remove the express checkout buttons from the DOM. In doing so users won't be able to use them at all, even if they unhide the button using CSS.
You might also add a custom CSS class to your template to hide the element before it gets removed by the javascript. You could do that by placing the following CSS in your template custom CSS file. Otherwise you can add an style
tag in the hook above.
.express-checkout-buttons {
display: none!important;
}