Remove Apple Pay Button on Product, cart & checkout Pages in Stripe Integration for WooCommerce

We introduced it a couple of days ago: Apple Pay is now available for WooCommerce sites using Stripe. That’s great news! But, I noticed that a common request is :

“How can I remove the Apple Pay button on the product page?”

Update: with Stripe 4+, the Apple Pay button has been removed from the checkout page, so the code isn’t accurate anymore

Because yes, the Apple Pay button is displayed on the product page, the cart and the checkout pages. So, here is a small function that will remove the Apple button on the single product page, you just need to copy and paste it in the functions.php file in your theme folder:

What about the cart page?

Also, if you want to remove the Apple Pay button on the cart page you can use this snippet:

And what about the checkout page?

and finally, if you want to remove it from the checkout page (…. humm… wait what would you do that?), use this one:

And that’s it!

3 responses to “Remove Apple Pay Button on Product, cart & checkout Pages in Stripe Integration for WooCommerce”

  1. lukeamoresano

    Hi Remi,

    What if you ONLY want to remove the Apple Pay function from a single product, not entirely. For instance, when you have a FREE product. It is confusing to still have what looks like a way to check out faster when, of course, you can’t check out with Apple Pay and a $0 product… although that would be really cool.

  2. razorfrog

    Thanks for this! One thing, the code as-is throws a hard error / white screen if WooCommerce is deactivated – not a very graceful fallback.

    Fatal error: Class ‘WC_Stripe_Apple_Pay’ not found in ….

    Probably should include a quick check to make sure WooCommerce is active beforehand. This works:

    if ( in_array( ‘woocommerce/woocommerce.php’, apply_filters( ‘active_plugins’, get_option( ‘active_plugins’ ) ) ) ) { }

    1. razorfrog

      Actually checking for the Stripe extension would be best:

      if ( in_array( ‘woocommerce-gateway-stripe/woocommerce-gateway-stripe.php’, apply_filters( ‘active_plugins’, get_option( ‘active_plugins’ ) ) ) ) {
      add_action( ‘init’, ‘remove_stripe_apple_pay_button’, 1 );
      }

Leave a Reply