1. Home
  2. Knowledge Base
  3. Sublium Subscription Checkout – User Account Handling Flow

Sublium Subscription Checkout – User Account Handling Flow

The Sublium Subscriptions for WooCommerce plugin implements an intelligent user account management system during checkout that seamlessly handles both new and existing customers purchasing subscription products. 

This system ensures subscriptions are always properly linked to user accounts while providing a smooth checkout experience.

The Problem 

Subscription products require ongoing management (renewals, cancellations, upgrades, etc.), which means every customer must have a user account.

However, standard WooCommerce behavior can fail in certain scenarios:

  • Scenario #1: Customer is already logged in
  • Scenario #2: Customer is new and has no account
  • Scenario #3: Customer is returning but forgets to log in, using an email already associated with an existing account

Traditional platforms often fail in Scenario #3, either blocking checkout or creating duplicate accounts.

The Solution

We’ve implemented smart account management to intelligently handle all three scenarios without disrupting the checkout flow or requiring any customer intervention.

Detailed Flow Scenarios

Depending on whether a customer is logged in, new, or returning, Sublium automatically adapts its account handling during checkout.

The following scenarios explain how the system behaves in each case to ensure every subscription and order is linked to the correct user account while maintaining a seamless checkout experience.

Scenario #1: Logged-In User (Existing Behavior)

Customer State: Already authenticated with an active session

Flow:

  1. Customer adds subscription product to cart
  2. Proceeds to checkout while logged in
  3. The order is processed normally
  4. Subscription is created and linked to their existing user account
  5. Order is associated with their user ID

Outcome: Standard checkout process with no special handling needed.

Scenario #2: Guest Checkout with New Email (New User Creation)

Customer State: Not logged in, email address doesn’t exist in the system.

Flow:

  1. Customer adds subscription product to cart
  2. Proceeds to checkout as a guest
  3. Enters billing information, including a new email address
  4. Order is processed by WooCommerce
  5. Our system detects that no user account exists
  6. Automatic Actions:
    1. Creates a new WordPress user account
    2. Uses billing email as username
    3. Sets first name and last name from billing details
    4. Tags account with source: “sublium-subscription-checkout”
    5. Automatically logs the customer in** (sets authentication cookie)
    6. Links order to the new user account
    7. Links subscription to the new user account

Outcome: Customer receives their order confirmation, has a new account created automatically, and is logged in. They can immediately access their subscription management dashboard.

Customer Experience: Customers don’t have to create an account. They simply receive welcome emails and can manage their subscription. Seamless. 

Scenario #3: Guest Checkout with Existing Email (Account Association)

Customer State: Not logged in, but email address already exists in the system.

Flow:

  1. Customer adds subscription product to cart
  2. Proceeds to checkout as a guest
  3. Enters billing information, including an email that matches an existing account
  4. The order is processed by WooCommerce
  5. Our system detects that the email already exists
  6. Automatic Actions:*
    1. Identifies the existing user account by email
    2. Links order to the existing user account
    3. Links subscription to the existing user account
    4. Does NOT automatically log the customer in (security feature)

Outcome: Order and subscription are associated with the correct existing account, but the customer remains logged out.

Customer Experience: They complete checkout successfully. They receive an order confirmation. If they already have account credentials, they can log in to manage their subscription. If they don’t remember having an account, they can use “Forgot Password” to regain access.

Technical Implementation Details

This section outlines the underlying logic that powers the smart account management system.

1. Key Components

Order Processing Hook

Triggered: `woocommerce_checkout_order_processed` (priority 9)

  • Checks if the cart contains subscription products
  • Processes each subscription in the cart

2. User Detection Logic

Check order->get_customer_id()
├─ If user_id exists (>0)
│ └─ Use existing user ID
└─ If user_id is empty (0)
└─ Call create_user_subscription()
├─ Check if email_exists()
├─ If YES (existing user)
│ ├─ Get existing user ID
│ ├─ Set order customer_id = existing user ID
│ ├─ Save order
│ └─ Return user ID (NO auto-login)
└─ If NO (new user)
├─ Create new WordPress user via wc_create_new_customer()
├─ Set order customer_id = new user ID
├─ Save order
├─ Auto-login user (wc_set_customer_auth_cookie)
└─ Return user ID

3. Subscription Creation

  • Subscription data includes user_id from the logic above
  • Order is linked to subscription via meta data
  • Both order and subscription share the same user_id
  • Activity log records subscription creation

Why We Removed WooCommerce Native Registration

Previously, Sublium relied on WooCommerce’s native registration flow, which forced customers to create accounts during checkout.

This approach often caused errors when an email already existed.

Previous Approach (Removed):

  • Forced registration form to appear on checkout
  • Used `$_POST[‘createaccount’] = 1` to trigger WooCommerce account creation
  • Problem: WooCommerce would fail checkout if the email already existed

Current Approach (Better)

  • Allow WooCommerce to process as a guest checkout
  • Handle user creation/association after the order is created
  • More flexible, never blocks checkout
  • Supports all three scenarios elegantly

Benefits & Advantages

  1. Seamless Customer Experience
  • No error messages about existing emails
  • No forced login requirements
  • No registration forms to fill out
  • Customers complete checkout without friction
  1. Smart Account Management
  • Prevents duplicate accounts for the same email
  • Automatically links orders to correct accounts
  • Works for both new and returning customers
  • Maintains data integrity
  1. Security Features
  • Only auto-logs in newly created accounts
  • Existing accounts require manual login (prevents unauthorized access)
  • Follows WordPress authentication standards
  • Protects existing user accounts
  1. Subscription Integrity
  • Every subscription is always linked to a user account
  • Orders and subscriptions share the same user_id
  • Enables proper subscription management
  • Supports renewals, upgrades, and cancellations
  1. Developer-Friendly
  • Clean, modular code following WordPress standards
  • Proper error handling with WP_Error objects
  • Action hooks for extensibility:sublium_checkout_subscription_created`
  • Comprehensive activity logging

Security Considerations

Auto-Login Decision

Why auto-login for new users?

  • They just created the account with their own email
  • Provides immediate access to their purchase
  • Standard e-commerce UX expectation

Why NO auto-login for existing users?

  • Email ownership doesn’t prove account ownership
  • A malicious act could check out with someone else’s email
  • Protects existing accounts from unauthorized access
  • User receives email notification about the order
  • A legitimate user can log in with their existing credentials

Email Validation

  • Uses WordPress core `email_exists()` function
  • Prevents duplicate user accounts
  • Maintains database integrity

Customer Communication

Effective communication after checkout helps customers understand what just happened and how to access their subscriptions.
To support the smart account management system, we recommends sending specific email notifications based on the customer’s checkout scenario.

For New Users (Scenario #2)

  • Welcome email with temporary password
  • Order confirmation
  • Subscription details and management link
  • How to access the account dashboard

For Existing Users (Scenario #3):

  • Order confirmation emphasizing “order placed with your existing account”
  • Subscription details with login link
  • Password reset link if needed
  • Customer support contact information

Common Questions

What if a customer uses an existing email but doesn’t know they have an account?

They can use the “Forgot Password” feature to reset their password and access their account with all orders and subscriptions.

Can customers still create accounts manually before checkout?

Yes, if they prefer to register first, they can. Then they’ll be in Scenario #1 (logged-in user).

What happens to guest orders without subscriptions?

This system only activates when the cart contains subscription products. Regular products follow standard WooCommerce behavior.

Can existing customers be automatically logged in?

No, for security reasons. They must manually log in, but the order/subscription will still be correctly associated with their account.

Does this work with all payment gateways?

Yes, this system operates independently of payment processing and works with any WooCommerce payment gateway.

Summary

This implementation provides intelligent, automatic user account management for subscription checkouts. 

It eliminates checkout friction, prevents duplicate accounts, maintains security, and ensures every subscription is properly linked to a user account – all without requiring customer intervention or understanding of technical details. 

The result is a professional, seamless checkout experience that handles edge cases gracefully.

Ready to Transform Your Subscriptions?

Join a growing community of WooCommerce store owners who rely on Sublium to power their recurring revenue.
Sublium WooCommerce subscription plugin support team - expert help and guidance
5 star rating from Sublium WooCommerce subscription plugin customer
Transform WooCommerce subscriptions with Sublium - superior plugin alternative