Skip Navigation

[Resolved] Display orders list for an user

This support ticket is created 7 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 7 replies, has 4 voices.

Last updated by grantP 7 years ago.

Assisted by: Shane.

Author
Posts
#579951

hello

I created a front-end order lists by following this guide
https://toolset.com/learn/create-an-ecommerce-wordpress-site/displaying-more-information-from-woocommerce/how-to-display-woocommerce-orders-on-the-front-end/

all ok.
But it lists ALL the orders.
I need to filter by "user" and show each user only his orders

any ideas?

#579969

y.S
#580053

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Screen Shot 2017-10-18 at 4.03.49 PM.png

Hi Luca,

Thank you for contacting our support forum.

Based on this tutorial you should have access to the _billing_email field. You can use this to filter the orders because the email on the order should be the one the user used on your website.

So you can filter the view by the customer's email, see screenshot

Then you just need to use our shortcodes to pass the customer's email into the view when you place it on a page.

For e.g [wpv-view name='my-order' email='[wpv-user field="user_email"]']

Please let me know if this helps.
Thanks,
Shane

#580150

Hello

What you said is exactly what I did
But if an user changes his billing email it is a problem because it won't show the old email orders

#580265

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Luca,

This is actually a limitation because of the information that the order stores from the user, where their email is the only unique identifier.

I would like to assume that a customer isn't able to change their billing email or if not you can impose a restriction. But this is a limitation to how woocommerce operates.

Thanks,
Shane

#580317

[wpv-post-field name='_customer_user']

seems to be the solution.
It connects the ID of the user to the order it seems. still testing by the way

#580368

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Luca,

Yes this should work if its actually on the order as a hidden meta.

Thanks,
Shane

#911937

Where do you put - [wpv-post-field name='_customer_user'] - I am having the same problem. I need to output the orders that relate only to a certain customer and not all of the