WordPress filter hook

wc_stripe_force_save_payment_method

Fired by 3 WordPress plugins, running on 801K+ sites between them.

“Filters the flag that decides if the payment method must be saved in all possible situations.”

How to use wc_stripe_force_save_payment_method

It's a filter: your callback receives the value and 1 more argument, and must return the (changed) value. Add this to your theme's functions.php or a small custom plugin:

functions.php
add_filter( 'wc_stripe_force_save_payment_method', function( $force_save_payment_method, $order_id ) {
	// Change $force_save_payment_method here.
	return $force_save_payment_method;
}, 10, 2 );

Argument names come from WooCommerce Stripe Payment Gateway's source. Other plugins may pass different values: check the call in the plugin you're targeting below.

3 plugins that fire wc_stripe_force_save_payment_method

Sorted by active installs. Each entry shows where the plugin calls the hook and what it passes.

  1. WooCommerce Stripe Payment Gateway icon WooCommerce Stripe Payment Gateway700,000+ installs apply_filters( 'wc_stripe_force_save_payment_method', $force_save_payment_method, $order_id ) includes/class-wc-stripe-helper.php:2216
  2. Payment Plugins for Stripe WooCommerce icon Payment Plugins for Stripe WooCommerce100,000+ installs apply_filters( 'wc_stripe_force_save_payment_method', false, $order, $this->payment_method ) includes/class-wc-stripe-payment-intent.php:252
  3. Subscriptions for WooCommerce with Stripe Recurring Payments icon Subscriptions for WooCommerce with Stripe Recurring Payments1,000+ installs apply_filters( 'wc_stripe_force_save_payment_method', false, $order->get_id() ) includes/Illuminate/Gateways/Stripe/Stripe.php:358

Need a customisation built on this hook?

Tell us what you want to change and which plugin it's for. We'll write it, test it and send it back as a small plugin.