Mobile App Refresh Campaign [Banner] 2024

Product Icon

Square

by  Woo
Accepting payments is easy with Square. Clear rates, fast deposits (1-2 business days). Sell online and in person, and sync all payments, items and inventory.

[Square] Add the option to turn off Google Pay/Apple Pay on individual product pages

Woocommerce + Square plugin – I would like the option to turn off Google Pay/Apple Pay on product pages, but still have the option on the basket/checkout pages

Author

Current Status

Open

Last updated: February 3, 2021

19 comments

Log in to comment on this feature request.

  1. screenprintsnfk says:

    To anyone coming here for the solutions, copy the code snippet DIRECTLY from https://woocommerce.com/document/woocommerce-square/faq/, if you copy it from this thread, the formatting will give you a 500 internal error.

  2. screenprintsnfk says:

    @admin825333b681 Belay my last, I looked at the way I typed the .php snippet that is added to functions.php, I had an error in the line structure that strangely passed through the snippet plug-in to get a 500 error, but when I typed it correctly and added to the functions.php file placed in the child theme, it works wonderfully. You will need to watch the vid to understand and place a child theme to put the modified functions.php file into via ftp upload. This allows the parent theme (the one you are most likely using now) to get allegedly get regular updates without without wiping the mod each time.
    Watch the vid and copy the code snippet DIRECTLY as formatted from https://woocommerce.com/document/woocommerce-square/faq/ (scroll down a bit to see it) into the functions.php file, save, u/l to the child theme folder in your wp-contents/themes directory. If the child theme is activated already, all you’ll have to do is a refresh. If not, I suggest activating the child theme first to make sure it’s smooth sailing, then u/l the modified functions.php file:

    add_filter( ‘wc_square_display_digital_wallet_on_pages’, function( $pages ) {
    return array(
    /* ‘product’, // Don’t show Apple Pay and Google Pay on product pages */
    ‘cart’,
    ‘checkout’,
    );
    }, 10, 1 );

  3. screenprintsnfk says:

    aadmin825333b681 I found this vid explaining the process, but I also found posts on Google detailing that now the functions.php alteration placed in a child theme page gets a 500 error and may be related to a broader WP update. Looking at the origin date of this post idk why it isn’t a simple switch available in the settings yet especially after we dump money on plug-ins and subscriptions to enhance the platform. It’s an all or nothing approach right now, digital wallets via Square are on or off globally everywhere.
    https://youtu.be/gmfE0A15vF8?si=iuCVYft8LHdJPra4

  4. admin825333b681 says:

    The code posted at https://woocommerce.com/document/woocommerce-square/faq/ doesn’t work for me. I can comment out the checkout and cart options in the code and that will successfully remove the button from the cart and checkout (which is not what I want to do), but the button still shows for me whether the “product” is commented out or not from the snippet.

    I wish @hautecreations would have given more clarification when he said he had to “activate it” after the snippet didn’t work initially. I’ve never had to activate a filter after putting it in my functions.php, so I have no clue what he’s talking about.

  5. chrisadvancedpckg says:

    Please ignore my comment below. It was meant for another thread and I was unaware comments are immutable.

  6. chrisadvancedpckg says:

    I don’t see any relevant hooks provided by woopayments / woocommerce, so this is the best you can do.

    Navigate to your woocommerce-payments plugin that is in your wp-content/plugins folder (file path as follows)
    wp-content/plugins/woocommerce-payments/includes/class-wc-payments-express-checkout-button-display-handler.php

    change this code:

    /**
    * Check if WooPay is enabled
    *
    * @return bool
    */
    public function is_woopay_enabled() {
    return $this->platform_checkout_button_handler->is_woopay_enabled();
    }

    to this:

    /**
    * Check if WooPay is enabled
    *
    * @return bool
    */
    public function is_woopay_enabled() {
    global $product;

    if(isset($product)){
    return false;
    }

    return $this->platform_checkout_button_handler->is_woopay_enabled();
    }

    This will check if the page is a product page and, if it is, disable woopay. Hope this helps.

    Cheers.

  7. Deron Blevins says:

    Add me to this, can’t believe this isn’t an option yet. For the love of ____, please add a toggle to turn off the google/apply pay button on product pages.

  8. aaronknightfineart says:

    The code posted at https://woocommerce.com/document/woocommerce-square/faq/
    Did remove the button from the product page. However, the code to load the Square .css and .js is still on every product page. I’d like to remove that as well.

  9. hautecreations says:

    IGNORE MY LAST RESPONSE. It does work. Make sure you activate it.

    add_filter( ‘wc_square_display_digital_wallet_on_pages’, function( $pages ) {
    return array(
    /* ‘product’, // Don’t show Apple Pay and Google Pay on product pages */
    ‘cart’,
    ‘checkout’,
    );
    }, 10, 1 );

  10. hautecreations says:

    Thanks @Petar. It did not work. I copied/pasted from both your writing below and directly from the FAQ.

  11. Petar Cvitanusic says:

    FYI After doing a little bit of digging you can add this to your themes functions.php file https://woocommerce.com/document/woocommerce-square/faq/.

    “`
    add_filter( ‘wc_square_display_digital_wallet_on_pages’, function( $pages ) {
    return array(
    /* ‘product’, // Don’t show Apple Pay and Google Pay on product pages */
    ‘cart’,
    ‘checkout’,
    );
    }, 10, 1 );
    “`

  12. Erin says:

    I found a solution for my situation. I want to use Square only, but Google Pay was showing up. I went to WooCommerce, Settings, Payments, scrolled down to Square and clicked “Manage”, then UN-CLICKED “Enable Digital Wallets”, which was showing the Google Pay option. Hope this helps.

  13. Massimo says:

    Hello,
    same question :
    We want Apple Pay with stripe on our website
    But HIDE de Apple Pay button ONLY on each product page?
    Best regards

  14. hautecreations says:

    Is there seriously still no answer to this?

  15. honeyjoyco says:

    Is there a setting for this yet??? ( turn off Google Pay/Apple Pay on individual product pages)

  16. FL Custom Flags says:

    did you find a solution for this?

  17. paco says:

    I JUST FIGURED IT OUT on your dashboard go to:
    WOOCOMMERCE>>SETTINGS>>PAYMENTS>>WOOCOMMERCE PAYMENTS MANAGE BUTTON>>CLICK THE BOX THAT SAYS “Enable payment request buttons (Apple Pay, Google Pay, and more).
    By using Apple Pay, you agree to Stripe and Apple’s terms of service.”

    It will remove the google button and apple buttons

  18. carla says:

    Thank you PACO!!!!

  19. Russ Castella says:

    This is ridiculous. There should be an option to remove these buy buttons from single product pages. They should stay on the checkout, but OFF from single pages.