On the admin side, you might need to display WooCommerce information inside the users table (WordPress Dashboard > Users). For example, their billing country. Or maybe some custom calculation e.g. the number of completed orders.
Either way, this is super easy. First, we add a new column – second, we tell what content should go inside it. Enjoy 🙂
Display a custom column @ Users WordPress Dashboard
Snippet (PHP): Show a Custom WooCommerce Column @ WordPress Admin Users Table
Please let me know in the comments if everything went as expected. I would be happy to revise the snippet if you report otherwise (please provide screenshots). I have tested this code with Storefront theme, the WooCommerce version listed above and a WordPress-friendly hosting.
If you think this code saved you time & money, feel free to join 17,000+ WooCommerce Weekly subscribers for blog post updates and 250+ Business Bloomer supporters for 365 days of WooCommerce benefits. Thank you in advance!
Need Help with WooCommerce?
Check out these free video tutorials. You can learn how to customize WooCommerce without unnecessary plugins, how to properly configure the WooCommerce plugin settings and even how to master WooCommerce troubleshooting in case of a bug!
Rodolfo Melogli
Business Bloomer Founder
Author, WooCommerce expert and WordCamp speaker, Rodolfo has worked as an independent WooCommerce freelancer since 2011. His goal is to help entrepreneurs and developers overcome their WooCommerce nightmares. Rodolfo loves travelling, chasing tennis & soccer balls and, of course, wood fired oven pizza.
13 thoughts on “WooCommerce: Add Column to Users Dashboard Table”
Bjoern
Hey,
great snippet.
But I´m facing a little issue with that. Im trying to insert the column for number of completet orders, but Im not able to find the right column. Billing_country and for example address are working fine. Any chance to tell me what column I need to define?
You can rename “billing_country” to whatever you like in the snippet, the important part is what you will do with the $customer variable. You will need to “read” all customer orders from there
Hey Jorge, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hey Rodolfo, this was a super helpful script. Was able to tweak it to show the Last Order date instead and had a question. Is there a way to make the new WC_Customer column sortable? Attempts to sort by the order date sorts by the username instead. Any ideas?
Jen, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
$customer->get_billing…. is used by WooCommerce to get WooCommerce fields, so that won’t work with a custom field. You should study the documentation of the plugin you used to add the custom field, and see how to retrieve it – that will give you the correct code to use. Hope this helps!
Hello Kinh, thanks so much for your comment! Yes, this is possible – unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R
Questions? Feedback? Support? Leave your Comment Now! _____
If you are writing code, please wrap it between shortcodes: [php]code_here[/php]. Failure to complying with this (as well as going off topic, not writing in English, etc.) will result in comment deletion. You should expect a reply in about 2 weeks - this is a popular blog but I need to get paid work done first. Please consider joining BloomerArmada to get blog comment reply priority, ask me 1-to-1 WooCommerce questions and enjoy many more perks. Thank you :)
With 100,000 (and growing) monthly organic sessions, Business Bloomer is the most consistent, most active and most complete WooCommerce development/customization blog.
Of course this website itself uses the WooCommerce plugin, the Storefront theme and runs on a WooCommerce-friendly hosting.
Hey,
great snippet.
But I´m facing a little issue with that. Im trying to insert the column for number of completet orders, but Im not able to find the right column. Billing_country and for example address are working fine. Any chance to tell me what column I need to define?
Cheers
You can rename “billing_country” to whatever you like in the snippet, the important part is what you will do with the $customer variable. You will need to “read” all customer orders from there
The best woocoommerce page/tips! Thansk a lot!
Can I add a column indicating that the purchase made was the customer’s first purchase?
Thanks for helping the community
Hey Jorge, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Hey Rodolfo, this was a super helpful script. Was able to tweak it to show the Last Order date instead and had a question. Is there a way to make the new WC_Customer column sortable? Attempts to sort by the order date sorts by the username instead. Any ideas?
Jen, thanks so much for your comment! Yes, this is definitely possible, but I’m afraid it’s custom work. If you’d like to get a quote, feel free to contact me here. Thanks a lot for your understanding!
Very useful snippet! Hey Rodolfo, could you please tell how to do it for multiple columns? Need to repeat the code or is there any efficient way? TIA
No need to create a new function, just add a new column:
Hi there
If I have to add billing country and billing_city, for example, how can I write the code?
I have added this
Is it correct?
Best regards
The code above works, but if I want to add a custom field (billing_wooccm16 that is a select type field with option of dropdown menu) and I write so
This code doesn’t work
$customer->get_billing…. is used by WooCommerce to get WooCommerce fields, so that won’t work with a custom field. You should study the documentation of the plugin you used to add the custom field, and see how to retrieve it – that will give you the correct code to use. Hope this helps!
Please help me Can add columns the day users create an account ? Thanks.
Hello Kinh, thanks so much for your comment! Yes, this is possible – unfortunately this is custom work and I cannot provide a complementary solution here via the blog comments. Thanks a lot for your understanding! ~R