Hey there,
The following code snippet will remove the PayPal button from the Cart page:
add_filter( 'wc_gateway_paypal_braintree_data', '_wc_remove_braintree_checkout_with_paypal' );
function _wc_remove_braintree_checkout_with_paypal( $data ) {
unset( $data['checkoutWithPayPal'] );
return $data;
}
Hope that helps!
Hello Mike, Thanks so much for the reply. I have not done any .php editing, but your reply got me looking. Which .php file do you suggest I put this in?
Also, now that you have me looking- I found another piece of code that is also of interest for doing this:
/**
* Whether checkout with PayPal from cart page is supported.
*
* @since 1.2.2
*
* @return bool Returns true if supported
*/
private function _is_checkout_from_cart_supported() {
return is_cart() && $this->does_checkout_with_paypal_support_shop_currency() && ! $this->does_cart_contain_any_subscriptions();
}
Thank you for the help. Let me know where you suggest adding your filter or if I can just make this a constant false boolean. Would there be any ripple effects for that?
Sorry about that! I should’ve included more information. This code snippet would need to be added to your themes functions.php file or via a plugin such as Code Snippets.
Thank you for the help. Let me know where you suggest adding your filter or if I can just make this a constant false boolean. Would there be any ripple effects for that?
Editing the plugin directly is a bad idea. Any changes would be overwritten in future updates.
Let me know if you have any trouble!
Thank you Mike,
I got the code in and it worked well on the cart page, however, there is a new issue on the checkout page:
Error: PayPal Powered by Braintree did not supply a payment nonce. Please try again later or use another means of payment.
My current fix for this issue which seems to retain full functionality on the checkout page is the following CSS code:
#paypal-braintree-button-container {
visibility: hidden !important;
}
slash1andy
(@slash1andy)
Automattic Happiness Engineer
Hey there @rdavenport3
Are you still having issues?
The last code I posted fixed the issue for me while adjusting the user experience to what I wanted.
Thanks for the follow-up.