Hide Place Order button (on WooCommerce Checkout page) when PayPal payment method (or any other) is chosen


Oct 4, 2021 | Divi Tips | 0 comments

With the latest release of the WooCommerce PayPal Payments module, there have been a lot of complaints. A client’s site was not working properly where if someone clicked the Place Order button it showed an error. But, the PayPal buttons below the Place Order button work. So, I found a script and modified it to hide the Place Order button if the PayPal option is chosen.
Hide checkout button when PayPal payment method is chosen

Add the following code to your child theme functions.php file.

TIP: In your browser console, look at the value field in the input for the payment option you want to hide. Copy the value, in this case is “ppcp-gateway”, replacing this value in the array field below.
* Hide checkout button when PayPal payment method is chosen - BEGIN */
 add_filter('woocommerce_order_button_html', 'remove_place_order_button_for_specific_payments' );
function remove_place_order_button_for_specific_payments( $button ) {
    // HERE define your targeted payment(s) method(s) in the array
    $targeted_payments_methods = array('ppcp-gateway');
    $chosen_payment_method     = WC()->session->get('chosen_payment_method'); // The chosen payment

    // For matched payment(s) method(s), we remove place order button (on checkout page)
    if( in_array( $chosen_payment_method, $targeted_payments_methods ) && ! is_wc_endpoint_url() ) {
        $button = ''; 
    return $button;

// jQuery - Update checkout on payment method change
add_action( 'wp_footer', 'custom_checkout_jquery_script' );
function custom_checkout_jquery_script() {
    if ( is_checkout() && ! is_wc_endpoint_url() ) :


Submit a Comment

Your email address will not be published. Required fields are marked *

More Tips

Ad - Web Hosting from SiteGround - Crafted for easy site management. Click to learn more.

Cloudways Hosting

WPEngine Hosting

Pressable Hosting

AccuWeb Hosting

Ask the Divi Guy a Question

"*" indicates required fields