This comprehensive guide will walk you through setting up a WooCommerce checkout system that uses Google Pay for payment processing while automatically creating user accounts and enabling Google social login functionality. This setup requires multiple components working together rather than a single integrated solution.
Prerequisites
Before starting, ensure you have:
- WordPress and WooCommerce on recent versions
- An SSL certificate with your site accessible over HTTPS
- A payment processor that supports Google Pay (WooPayments or Stripe)
- Administrative access to your WordPress dashboard
Part 1: Setting up Google Pay express checkout
Method 1: Using WooPayments (recommended)
WooPayments is the official WooCommerce payment solution that provides integrated Google Pay support:
- Install WooPayments
- Go to Plugins > Add New and search for “WooPayments”
- Install and activate the plugin
- Configure WooPayments
- Navigate to Payments > Settings in your WordPress dashboard
- Check “Enable WooPayments” box
- Complete the account setup process
- Enable Google Pay
- Go to Payments > Settings
- Navigate to the Express Checkouts section
- Check the box for Apple Pay / Google Pay
- Scroll to the bottom and click Save Changes
Note: Google Pay and Apple Pay must be enabled together in WooPayments
Method 2: Using Stripe payment gateway
If you prefer using the Stripe gateway instead of WooPayments:
- Install WooCommerce Stripe Payment Gateway plugin
- Go to WooCommerce > Settings > Payments
- Enable Stripe and configure with your API keys
- Check “Payment Request” buttons option to enable Google Pay
Customizing Google Pay button placement
After enabling Google Pay, you can customize where the button appears by selecting the Customize link for Apple Pay / Google Pay in the Express Checkouts section. You can display the button on:
- The checkout page
- The cart page
- Individual product pages
Part 2: Implementing automatic account creation after payment
WooCommerce can automatically create user accounts only after successful payment using custom code. This prevents account creation for failed or pending payments.
Step 1: Configure WooCommerce account settings
First, ensure the following setting is configured:
- Go to Dashboard > WooCommerce > Settings > Account & Privacy
- Uncheck “Allow customers to create an account during checkout”
Step 2: Add custom code for account creation
Add this code to your theme’s functions.php file or use the Code Snippets plugin. This code uses the recommended wc_get_order() function and modern WooCommerce getter methods for maximum compatibility:
/**
* Automatically create user account after successful payment
* Compatible with WooCommerce 3.0+ and follows modern WooCommerce best practices
*/
add_action( 'woocommerce_thankyou', 'create_user_account_after_payment', 10, 1 );
function create_user_account_after_payment( $order_id ) {
// If user is already logged in, do nothing
if( is_user_logged_in() ) return;
// Get the order object using recommended method
$order = wc_get_order( $order_id );
if( !$order ) return;
// Get billing email using getter method (modern WooCommerce approach)
$order_email = $order->get_billing_email();
if( empty( $order_email ) ) return;
// Check if user already exists
$email_exists = email_exists( $order_email );
$username_exists = username_exists( $order_email );
// Only create account if user doesn't exist and payment is successful
if( $username_exists == false && $email_exists == false &&
($order->has_status( 'processing' ) || $order->has_status( 'completed' )) ) {
// Generate secure password
$password = wp_generate_password( 12, false );
// Create the user account
$user_id = wp_create_user( $order_email, $password, $order_email );
if( !is_wp_error( $user_id ) ) {
// Set user meta from order data using getter methods
update_user_meta( $user_id, 'first_name', $order->get_billing_first_name() );
update_user_meta( $user_id, 'last_name', $order->get_billing_last_name() );
update_user_meta( $user_id, 'billing_first_name', $order->get_billing_first_name() );
update_user_meta( $user_id, 'billing_last_name', $order->get_billing_last_name() );
update_user_meta( $user_id, 'billing_phone', $order->get_billing_phone() );
// Assign customer role
$user = new WP_User( $user_id );
$user->set_role( 'customer' );
// Link the order to the new user
$order->set_customer_id( $user_id );
$order->save();
// Auto-login the user
wp_set_current_user( $user_id );
wp_set_auth_cookie( $user_id );
// Send new account notification email
wp_send_new_user_notifications( $user_id, 'user' );
}
}
}
Code compatibility
This code uses the WooCommerce team’s recommended wc_get_order() wrapper function and modern getter methods like get_billing_email() instead of direct property access. This ensures compatibility with:
- WooCommerce 3.0 and newer versions
- Modern WooCommerce stores using HPOS (High-Performance Order Storage)
- Future WooCommerce updates that may change underlying data structures
The code will work with all standard WooCommerce installations, but you should test it on your specific setup, especially if you have:
- Custom checkout modifications
- Third-party payment gateways with non-standard order flows
- Custom order status configurations
Part 3: Setting up Google social login
Installing WooCommerce social login (premium option)
WooCommerce Social Login is a premium plugin ($79/year) that provides comprehensive social login functionality:
- Purchase and install
- Purchase from WooCommerce marketplace
- Install and activate the plugin
- Configure Google app
- Visit Google Cloud Console and create a new project
- Enable Google+ API or Google Sign-In API
- Create OAuth 2.0 credentials
- Copy the Client ID and Client Secret
- Plugin configuration
- Go to WooCommerce > Settings > Social Login > Google
- Enter your Google Client ID and Secret
- Save settings
Alternative: Nextend social login (free option)
Nextend Social Login provides a free version with Google login support:
- Install from WordPress plugin repository
- Configure Google app credentials (same process as above)
- Configure plugin settings for Google login
Configuring social login display
You can display social login buttons on various pages including checkout, login, and registration pages. Configure these options in the plugin settings:
- Login page
- Registration page
- Checkout page
- My Account page
Part 4: Integration and account linking
How account linking works
When a customer uses Google social login with the same email address as their existing WooCommerce account, the social profile will automatically link to their site account.
The process works as follows:
- Customer completes Google Pay checkout
- Account is automatically created with their email
- On future visits, customer can use Google social login
- If the email matches, accounts are automatically linked
Important account linking considerations
Security measures are in place for account linking:
- Admin and shop manager accounts will not allow automatic linking by email for security reasons
- Only customer accounts with matching emails will be automatically linked
Conclusion
This setup provides a comprehensive solution for integrating Google Pay express checkout with automatic account creation and Google social login in WooCommerce. While it requires configuring multiple components, the result is a streamlined checkout experience that automatically creates customer accounts and enables easy future access through Google social login.
The combination reduces checkout friction, improves customer experience, and can lead to increased conversion rates and customer retention.





