• Resolved rdavenport3

    (@rdavenport3)


    Hello,
    My question is: can I remove the button for paypal checkout on the Cart page? I would prefer to send the customer through the paypal prompt only after they see all the options of payment which is shown on the checkout page (after the cart page).

    I am using woocommerce and on the Cart page, the buttons at the bottom are:
    1.Paypal Checkout (through Braintree)
    2.Update Cart
    3.Proceed to Checkout

    If Proceed to Checkout is clicked without first going through the Paypal Checkout prompt then the customer goes to the Checkout page and can select either credit card or paypal as the payment method. If paypal is checked then the login for paypal comes up when Place Order button is clicked.

    https://wordpress.org/plugins/woocommerce-gateway-paypal-powered-by-braintree/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Mike M. a11n

    (@mikedmoore)

    Automattic Happiness Engineer

    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!

    Thread Starter rdavenport3

    (@rdavenport3)

    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?

    Mike M. a11n

    (@mikedmoore)

    Automattic Happiness Engineer

    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!

    Thread Starter rdavenport3

    (@rdavenport3)

    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.

    Thread Starter rdavenport3

    (@rdavenport3)

    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?

    Thread Starter rdavenport3

    (@rdavenport3)

    The last code I posted fixed the issue for me while adjusting the user experience to what I wanted.

    Thanks for the follow-up.

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Paypal functionality’ is closed to new replies.