Skip to content

Instantly share code, notes, and snippets.

@bekarice
Last active November 11, 2025 14:47
Show Gist options
  • Select an option

  • Save bekarice/54ec1a502a0b9be8e28db52e2e88c41f to your computer and use it in GitHub Desktop.

Select an option

Save bekarice/54ec1a502a0b9be8e28db52e2e88c41f to your computer and use it in GitHub Desktop.
Automatically link previous orders to new WooCommerce customer accounts upon registration
@djrobinfm
Copy link

Hi,

I've made a big mistake, I'm afraid. People who can buy a LearnDash online course via WooCommerce, were able to check out as a guest in WooCommerce. This wasn't possible before, but an update caused the issue I guess. Anyway: I solved the issue for all new orders, but still: there are several customers who have checked out as a guest, while they must have an account to access the course.

So for those who did check out before as a guest, I want to automatically create an account based on their email addresses.

Is there a way I can run a script like this or something else, that creates accounts for all guest checkouts?

@alprio
Copy link

alprio commented Oct 21, 2024

so it works, if someone makes an account , their orders will be linked, but if then logs out and make an order as a guest and then he logs in again , this order will no be linked.

@alphaantenna
Copy link

Is working on the latest version of WooCommerce and Wordpress as of the date of this post at (https://www.alphaantenna.com) even though the site supporting this plugin is no longer in existence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment