View Categories

Cart Emptied After a Customer Registers

If the cart empties when a customer creates an account with Customer Email Verification for WooCommerce active, the new unverified user is being logged out right after sign-up. Go to WPFactory > Email Verification (also reachable at WooCommerce > Settings > Email Verification) > Advanced and set Login prevention method to Use login filter from WooCommerce.

Symptoms #

  • A shopper adds products, registers on the My Account page, and the cart is empty afterwards.
  • The problem disappears when Email Verification is deactivated.
  • You have to require an account before checkout, so the lost cart costs you orders.

Why it happens #

Prevent login after register is on by default, so unverified customers are not left logged in after they register. With the default Login prevention method, Logout right after login, WooCommerce logs the new customer in and Email Verification logs them straight out again. Logging out ends the shopping session that held the cart.

Causes and fixes #

  1. Stop the login instead of logging out afterwards (recommended). On the Advanced sub-tab, in the Prevent login after register group, set Login prevention method to Use login filter from WooCommerce. This sets WooCommerce’s woocommerce_registration_auth_new_customer filter to false, so WooCommerce never logs the unverified customer in, and there is no logout to clear the session. The customer still sees the “Activate” notice asking them to check their email.
  2. Use the custom logout function. If you need to keep Logout right after login, enable Custom “logout” function (Advanced Options group). It replaces the standard wp_logout() call with a version that skips the wp_logout action. The plugin’s own help text recommends it when the cart is cleared after a new account is created.
  3. Block the login cookie instead. Setting Authenticate filter to “send_auth_cookies” filter stops the login cookie from being sent to unverified users, so they are not logged in to begin with. Test this on a staging site first, because it also changes how normal logins by unverified users are blocked.
  4. Let unverified users stay logged in (last resort). Unticking Prevent login after register keeps the customer logged in after registration, with their cart. Block unverified login (General sub-tab) still stops them from logging in again later until they verify. Only use this if the options above do not work with your theme or registration form.

If your registration or login form comes from a page builder or a popup plugin, also check the Pro integrations on the Compatibility sub-tab. See Plugin Conflicts with Theme or Plugins: Troubleshooting.

How to confirm it is fixed #

  1. Open your store in a private browser window and add a product to the cart.
  2. Register a new account on the My Account page with an email address you can check.
  3. Check that the “Activate” notice appears and open the cart: the product should still be there.
  4. Click the link in the activation email and confirm the account is verified.

FAQ #

Are these options free? #

Yes. Prevent login after register, Login prevention method, Custom “logout” function and Authenticate filter are all in the free version. For every option on this sub-tab, see Email Verification: Advanced Settings Reference.

Does this affect customers who create an account at checkout? #

Not in the same way. For accounts created during checkout, Prevent login after checkout logs the unverified customer out after the order is placed, when the cart has already become an order.

Still stuck? #

Send us your theme name, the registration form or plugin you use, and a short screen recording. Our team answers every ticket on the Email Verification support forum.