When using the Stripe payment gateway for WooCommerce, you may want to remove the Payment Request buttons (such as Apple Pay and Google Pay) from single product pages.
This method ensures the Payment Request buttons are still available during the checkout process — it disables them on single product pages only.
To remove the Payment Request buttons, add this line of code to the functions.php file located in the root folder of your WordPress theme:
add_filter( 'wc_stripe_hide_payment_request_on_product_page', '__return_true' );
To avoid overwriting the file during upgrades, ensure you are using a child theme so that your edits persist.
Recommended reading
Increase the WordPress PHP max input variables
Extend the number of variables WordPress can use in a single function.
30 June 2020
Increase the WordPress memory limit
How to fix an allowed memory size exhausted error in WordPress.
30 June 2020
Remove dates from WordPress URLs
Prevent WordPress from saving media files into year and month folders.
7 June 2020
How to clear the Safari cache on your iPhone
Learn how to clear the Safari browser cache on your iPhone without removing your browsing history.
23 July 2021