[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
Current Status
Open
Last updated: February 3, 2021
15 comments
Log in to comment on this feature request.
Please ignore my comment below. It was meant for another thread and I was unaware comments are immutable.
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.
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.
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.
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 );
Thanks @Petar. It did not work. I copied/pasted from both your writing below and directly from the FAQ.
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 );
“`
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.
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
Is there seriously still no answer to this?
Is there a setting for this yet??? ( turn off Google Pay/Apple Pay on individual product pages)
did you find a solution for this?
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
Thank you PACO!!!!
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.