Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Support Mike M. a11n

    (@mikedmoore)

    Automattic Happiness Engineer

    Hi there,

    While the plugin doesn’t offer the option to hide PayPal on checkout, it can be done with a filter added to your functions.php file.

    The following will remove PayPal from the checkout page:

    add_filter( 'woocommerce_available_payment_gateways', '_wc_remove_braintree_pay_with_paypal' );
    function _wc_remove_braintree_pay_with_paypal( $gateways ) {
        unset( $gateways['paypalbraintree_paypal'] );
        return $gateways;
    }

    To remove the PayPal button from the cart page, you’ll need the following code:

    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;
    }

    Please note that it is recommended to use a child theme when adding code to your functions.php file. Also, I would recommend having FTP access handy when adding the snippets above. Just in case you need to revert changes quickly.

    Let me know if that does the trick ??

    Just thought I’d share an experience I just had with removing PayPal from the cart page.

    If PayPal is unset on the cart page, but not removed from the checkout page, clicking on “Place Order” results in the error:

    Error: PayPal Powered by Braintree did not supply a payment nonce. Please try again later or use another means of payment.

    Once the code to unset PayPal was removed, the issue went away and PayPal transactions went through just fine.

    I ended up just setting both PayPal buttons to not display via css for the cart page:

    	body.page-cart button.paypal-button,
    	body.page-cart a.braintree-paypal-button {
    		display: none !important;
    
    	}

    I hope this helps someone not have a lot of frustration.

    Hi Joseph and Mike,

    During my search to find a solution to very same issue, I came across a thread that told me to add this to my css and it worked flawlessly: (I was having trouble because my Free Product would still show this PayPal button in the cart… very confusing for customers)

    .woocommerce-cart #paypal-braintree-button-container {
        display: none;
    }

    I got the suggestion from here:
    Remove Braintree PayPal Checkout button from WooCommerce Cart

    Thank you both for contributing to challenges such as these. It is vital to kill frustration when setting up your ecommerce.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Hide paypal payment option’ is closed to new replies.