10 Comments

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

    Reply
  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.

    Reply
    • 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.

      Reply
  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.

    Reply
    • 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 🙂

      Reply
  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?

    Reply
  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.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

Error: Please enter a valid email address

Error: Invalid email

Error: Please enter your first name

Error: Please enter your last name

Error: Please enter a username

Error: Please enter a password

Error: Please confirm your password

Error: Password and password confirmation do not match