register customers in stripe

Automatically Register Customers in Stripe

By default, when an order is placed on a WooCommerce site using Stripe, the order is obviously sent to Stripe, a payment is stored, but a Stripe customer is created only if the “saved cards” feature is used, otherwise no customer is created in Stripe.

Automatically Register Customers in Stripe for orders placed in WooCommerce

To create a customer in Stripe for every single order placed on WooCommerce, you can add this code snippet to your theme’sfunctions.php file in your theme folder, or you can add it using a plugin like Code Snippets.

//Force customer creation process in Stripe
add_filter( 'wc_stripe_force_save_source', '__return_true' );

HOW TO ADD PHP CODE

The Code Snippets plugin makes it very easy to not just add PHP snippets to your website but also manage all the snippets you add.

You can activate and deactivate certain snippets, and even adds notes about what they do. It even has better error handling to avoid the PHP error scenarios.

To install it, simply go to Plugins > Add New and search for Code Snippets.

The traditional or normal way to add PHP snippets to your theme is to add directly in your theme’s functions.php file.

However, make sure you are using a child theme otherwise you will lose all changes once you update your theme.

Leave a Reply

Your email address will not be published. Required fields are marked *