15 Comments

  1. […] has a tutorial on automatically linking past orders to WooCommerce customers when they register on your […]

  2. I had always wondered why this was not done automatically. It makes perfect sense now after reading your explanation of how it works.

    I did a little digging and found that the Customer List report actually does a similar search for previous orders just to decide if the button to link previous orders should be shown or not. It only returns the first order it can find with a matching e-mail address, but it’s still pretty intensive. The report won’t even finish loading the page on a site I have with a lot of orders—and now I understand why.

    • Yep, that makes sense! As you can see this query is already being abstracted to use the new wc_get_orders() method, so hopefully when the underlying structure changes it can be much faster.

  3. Hi, what is, in your opinion, best setup for WC shop owners,
    when they just starting fresh on-line store?
    To force only registered users to register before buying product,
    and in long termprevent this time-consuming wc queries on register.
    Or allow unregistered users to buy, and when a blog/shop gets large
    in any post types number remove this snippet?
    Will WC authors consider to add this functions as default?
    Sorry for my poor English.

    • Hey Gabrielle, we recommend allowing guest checkout, as there’s a fair bit of research that indicates allowing guest checkout improves conversions. I’d likely recommend this approach: “Or allow unregistered users to buy, and when a blog/shop gets large in any post types number remove this snippet?” Hopefully, for a new store, by the time your store gets large enough that this snippet would cause issues, WooCommerce will have already moved orders to a new data type (not posts), so one could avoid the issues I’ve outlined here 🙂

  4. Has this happened yet: “when WooCommerce migrates to a custom data structure (probably in v3.0) this query could likely be optimized a lot by then”?
    If WooCommerce has migrated to a custom data structure does your code need to be updated and if so how?

  5. Thank you Beka!

    I’ve used a lot of your snippet and tutorials and it’s the time to show you some love 😀

    when I search for a little complicated WooCommerce problem, I usually find the solution here. super super helpful.

    Also, your plugins rocks! my clients are the ones who purchase it so I didn’t have a chance to post a review on them myself. but will definitely do when I run my own e-commerce site.

    Thanks again, have a nice day.

  6. Thanks Beka, could you tell me how can we send an automatic reset password email to the new users?!

  7. Hi Beka,

    This is a great solution. But is this updated for the latest Woocommerce? I’ve tried installing the plugin but it didn’t work. Hope to hear from you!

    • Hey Leon, it still works with the latest version, so I’d switch to a default theme like Storefront + deactivating other plugins, as this is likely a theme or plugin conflict on your site.

      • Hi Beka,

        is there a script i can use to bulk link all previous orders for all my guests orders?

  8. I love the reports section but I wish it had a little more control. Like if the columns were sortable, especially by Money Spent.

    Also if there was a customer view that showed each customer’s spend on the store in a given time frame, but a view that showed all customers. Basically the Custom time frame feature but applied to individual customer sales/spend.

    Thanks for the great tutorial!

    Cheers,
    Zach

Hmm, looks like this article is quite old! Its content may be outdated, so comments are now closed.