A simple way to list WooCommerce orders in the front end

August 18, 2020 34 comments

List WooCommerce Orders Front End

If you need to list WooCommerce orders on the front end of your website then you can do this with our Posts Table Pro plugin, a WordPress table plugin. It displays orders in a responsive table for front end WooCommerce inventory management. This is the complete guide on how to display WooCommerce orders in the front end using Posts Table Pro.

Posts Table Pro
Start listing WooCommerce orders on the front end of your WordPress site.

What is Posts Table Pro?

Posts Table Pro is a popular WordPress table plugin developed and supported by us at Barn2 Media. It lists any type of WordPress content in a structured HTML table. This includes pages, posts, custom post types, and – you guessed it! – WooCommerce orders!

The plugin is very flexible and comes with dozens of options. You can choose which columns of order data to include in the table, how the table is sorted, and much more.

Please note that we have another plugin called WooCommerce Product Table. This lists normal WooCommerce products in a table. Surprisingly, this is NOT the right plugin to list WooCommerce orders in the front end. WooCommerce orders aren’t products – they’re a separate custom post type. This means that you need to list them using our Posts Table Pro plugin.

I’m going to tell you how to list all WooCommerce orders in the front end, and how to show orders for a specific customer only.

Let’s get started!

How to list WooCommerce orders in a table on the front end

Follow these steps to create an instant table of WooCommerce orders:

  1. Get the Posts Table Pro plugin.
  2. Install the plugin and activate your license key. You’ll receive instructions for this in your confirmation email.
  3. Go to the page you want to list WooCommerce orders on the front end. Add the following shortcode:
[posts_table post_type="shop_order" columns="id:Order ID,date,cf:_shipping_first_name:First Name,cf:_shipping_last_name:Last Name,cf:_shipping_address_1:Address 1,cf:_shipping_city:City,cf:_shipping_postcode:Postcode,cf:_billing_phone:Phone,cf:_order_total:Total ($)" status="any" links="none"]

This will create a table of WooCommerce orders that looks like this:

List WooCommerce Orders Plugin

I’ve added some commonly used columns to get you started. These include the order ID, date, name, shipping address, phone number and total order cost.

A few notes on creating your own table of WooCommerce orders:

  • You must include the status option in the shortcode, otherwise no orders will show in the table.
  • It’s also essential to set columns using the columns option. If you don’t, then the default columns will be used, which are designed for displaying posts rather than orders.

Keep reading to learn how to customize the list of WooCommerce orders and change what information is displayed.

What else can I list in the table of WooCommerce orders?

The example includes some sample columns, but you don’t have to use these. There are lots of possible columns that you can include in the table of WooCommerce orders. Feel free to add whichever you need. Simply add them to the comma separated list in the ‘columns’ section of the Posts Table Pro shortcode (see above).

Standard order fields

The shop_order post type in WooCommerce comes with some built-in fields containing your order data. These are stored in the wp_posts database table:

  • Order ID (this is the ID number for the order in the WordPress database) – use the id column.
  • The order date – use the date column.
  • The order status (e.g. Completed or Processing) – use the status column.

Order meta fields

In addition, you can add columns in the table for any of the custom fields associated with WooCommerce orders. These are stored in the wp_postmeta database table and here’s a list of them all. You need to add cf: before each one to display them in the table of orders, so I have added this before each one for you:

  • Customer IP address – cf:_customer_ip_address
  • Customer’s browser and operating system – cf:_customer_user_agent
  • How the order was created (this will normally say ‘checkout’ – cf:_created_via
  • Billing details:
    • Complete billing information (lists the name, address etc. in a single column of the table) – cf:_billing_address_index
    • Billing first name – cf:_billing_first_name
    • Billing last name – cf:_billing_last_name
    • Billing company name – cf:_billing_company
    • Billing email address – cf:_billing_email
    • Billing phone number – cf:_billing_phone
    • Billing country – cf:_billing_country
    • Billing address line 1 – cf:_billing_address_1
    • Billing address line 2 – cf:_billing_address_2
    • Billing city – cf:_billing_city
    • Billing state – cf:_billing_state
    • Billing postcode – cf:_billing_postcode
  • Shipping details (if different from billing details):
    • Complete shipping information (lists the name, address etc. in a single column of the table) – cf:_shipping_address_index
    • Shipping first name – cf:_shipping_first_name
    • Shipping last name – cf:_shipping_last_name
    • Shipping company name – cf:_shipping_company
    • Shipping country – cf:_shipping_country
    • Shipping address line 1 – cf:_shipping_address_1
    • Shipping address line 2 – cf:_shipping_address_1
    • Shipping city – cf:_shipping_city
    • Shipping state – cf:_shipping_state
    • Shipping postcode – cf:_shipping_postcode
  • Order payment data:
    • Currency – cf:_order_currency
    • Do prices include tax? – cf:_prices_include_tax
    • Payment method code – cf:_payment_method
    • Payment method name – cf:_payment_method_title
    • Total order cost – cf:_order_total
    • Shipping cost – cf:_order_shipping
    • Total discount – cf:_cart_discount
    • Payment date – cf:_date_paid
    • Payment date (user-friendly format) – cf:_paid_date
  • Tax information:
    • Total tax – cf:_order_tax
    • Shipping tax – cf:_order_shipping_tax
    • Tax discount – cf:_cart_discount_tax
  • Transaction ID (e.g. if you’re using PayPal) – cf:_transaction_id
  • Order status data:
    • Date the order was marked as complete – cf:_date_completed
    • Date the order was marked as complete (user-friendly format) – cf:_completed_date

Note: This will also be useful if you’re looking for a list of database fields for WooCommerce orders. I couldn’t find a list of these fields anywhere else online, so I went through the WordPress database and figured it out myself. If you’re using these order field names for another purpose, remove the cf: from the beginning as this is only used to display them using the Posts Table Pro WordPress table plugin. The actual name for the custom fields begins with an underscore ( _ ) and doesn’t include cf:.

List WooCommerce orders based on their status

In the shortcode above, I showed you how to list all orders regardless of status. If you prefer, you can set the table to display orders with a specific status only. Simply replace any with the appropriate status:

  • Completed orders – wc-completed
  • Orders pending payment – wc-pending
  • Payment processing – wc-processing
  • On hold orders – wc-on-hold
  • Cancelled orders – wc-cancelled
  • Refunded orders – wc-refunded
  • Failed payment – wc-failed

For example:

[posts_table post_type="shop_order" columns="id,date,cf:_order_total" status="wc-completed" links="none"]

Other options to customize your list of WooCommerce orders

As I mentioned earlier, Posts Table Pro comes with dozens of options for customizing the display of your orders for WooCommerce inventory management. As well as choosing your columns, you can control the default sort order, show or hide elements such as the search box, and much more.

You may have noticed that I customized some of the column names in the example shortcode above. Here’s a direct link to how you can do this yourself, for any of the table columns.

You can read about all the options in the plugin knowledge base.

I added links="none" to my shortcode to list WooCommerce orders. This is because by default, Posts Table Pro will add a broken link to the Order ID column. The reason the link is broken is because it’s pointing to a front end page for the WooCommerce order, which doesn’t exist. As a result, I have shown you how to disable all links in the table of WooCommerce orders.

If you really wanted to link the ID column to the ‘Edit Order’ page in the WordPress admin, then you could write some custom code to achieve this. If you don’t know how to do this, then I recommend posting a job on Codeable to find a suitable WordPress expert.

Can I list the products for each order?

Unfortunately not, because WooCommerce doesn’t store this in the WordPress database in a way that Posts Table Pro can display. You will need to view the individual order in the WordPress admin to access the list of products.

Here’s a quick tip on the fastest way to do this:

  1. Copy the Order ID from the list of WooCommerce orders.
  2. Go to [your-domain]/wp-admin/post.php?post=12345&action=edit – replacing 12345 with the Order ID that you wish to look up.

This will take you straight to the Edit Order screen, which includes a list of products ordered.

Don’t forget customer confidentiality!

List WooCommerce orders securelyThe reason WooCommerce doesn’t come with a built-in option to display orders in the front end is because this information is normally confidential.

However, there are some situations where it’s appropriate to list WooCommerce orders on the front end.

For example, you might want to create a hidden page for delivery drivers to see, without giving them access to the WordPress admin. You might want to do the same for your administrative or finance staff. This is where the plugin comes in useful for front end WooCommerce inventory management.

Whatever your reason for displaying WooCommerce orders in the front end, make sure you add the appropriate security measures to protect customer data.

As a minimum, this should include using an SSL certificate, and hiding the list of orders on a password protected page or other hidden area. Your list of WooCommerce order data should only be available to people who really need access to it.

Can customers see a front end list of their own orders?

Yes, and you don’t need any extra plugins to do this. The Woo ‘My Account’ page in already includes a list of orders, so customers just need to login and view their past orders. There’s also a shortcode for this, which you can add anywhere customers are logged into their account: [my_orders]

But if you want to list all WooCommerce orders in the front end, then you’ll need Posts Table Pro for this.

Can customers see a list of their own orders?

So far, I’ve shown how you to list ALL orders from WooCommerce in the WordPress front end for WooCommerce inventory management. But what if you want to show orders for the current user only? For example, if you’re running a multi-vendor site then you might want each vendor to view a table or report of their own orders.

Unfortunately this is a bit tricky because WooCommerce doesn’t store the customer details as a taxonomy on the ‘shop_order’ post type that you can use to control which orders to include in the table. As a result, you need to create a new way to store this information so that Posts Table Pro knows which orders relate to the current customer.

Here are two suggested workarounds. The first is aimed at non-technical users and requires a bit of manual work. The second is for developers and is more automated.

Option 1 – Create a hidden page for each customer listing their orders

  1. Add a hidden page for each customer and password protect it.
  2. Create a custom taxonomy called ‘Customer’ or similar, and use it to tag each order with the correct customer’s username or ID.
  3. Use Posts Table Pro to list the customer’s orders on the page. Use the term option to list orders for that customer only. For example, this shortcode will list completed orders that are tagged with ‘user1’ in the ‘customer’ taxonomy:
    [posts_table post_type="shop_order" columns="id,date,cf:_order_total" status="wc-completed" links="none" term="customer:user1"]
  4. Send the customer a link to their page, along with the password.
  5. Repeat steps 1-4 for all the customers who need to see their own orders in the WP front end.

Option 2 – Automated solution

For a more automated solution with less manual work, here’s an alternative method for you (or your developer):

  1. Create a custom taxonomy on the ‘shop_order’ post type, and code it to automatically populate with the username of the person who placed the order.
  2. Modify the template for the WooCommerce Account page to replace the default list of orders with a Posts Table Pro shortcode: [posts_table post_type="shop_order" columns="id,date,cf:_order_total" status="wc-completed" links="none" term="customer:user1"]
  3. Replace “customer” in the shortcode with the slug of the taxonomy you created in step 1 a minute ago.
  4. Instead of “user1”, you need to dynamically populate this part of the shortcode with the customer’s username (which you are storing as a taxonomy term, as described in step 1).
Need professional assistance?
We've partnered with Codeable to provide our customers with expert help if required.

Once you have done this, the WooCommerce Account page will include a table listing orders for the current user.

Over to you!

By now, you have all the information you need to list WooCommerce orders for front end WooCommerce inventory management.  Get the WordPress table plugin, Posts Table Pro, and set it up today!

Posts Table Pro
Start listing WooCommerce orders on the front end of your WordPress site.

I’d love to hear how you are using lists of WooCommerce orders on the front end of your website. What information do you include? What do you use it for? How have you made sure your customer data is safe? Please leave your comments below.

Katie Keith

An active member of the global WordPress community, Barn2 Co-Founder Katie loves collaborating with other plugin companies. Her articles have been published on high profile sites including WPTavern, Torque and IndieHackers. She oversees all plugin support and deals with 'Tier 2' support requests about how to use Barn2's plugins in advanced ways.

34 Comments

  1. Webbituote
    April 22, 2020 Reply

    Hey,

    I found your plugin, and I would need some guindance if it suits our needs:

    We are building a website with WooCommerce, where our client is selling trainings. They would like to get all the orders into one list.

    We will create some additional fields for product options, and these info should be on the list as well. Every training should be able to get to separate list.

    I hope you understand, waiting to hear your response!

  2. Ryan
    February 20, 2020 Reply

    Hi,
    Can we display the action like view the order or download the PDF invoice/PL on woocommerce order front end? Please see screenshot https://prntscr.com/r4wfwl

    Thank you!

    • EJ
      February 26, 2020 Reply

      Hi, Ryan. Thanks for the screenshot.

      Posts Table Pro displays on the front-end of your site and the links required for the type of buttons you're asking about would need to point to the back-end "Edit Order" page of your site. While this is beyond what the plugin is designed to do, you can achieve this via custom code if you or your developer know how. For more details about this, please see: WooCommerce inventory management: Can I link to the individual order?

      If you don't have a developer who can do this for you or would like developer-level assistance to do this, then I recommend that you post a job on Codeable where their pre-approved WordPress experts will send you a quote.

  3. Matt M
    October 6, 2019 Reply

    Can I have export buttons like in other datatable plugins? for example: a button to download CSV file?

    • EJ
      October 10, 2019 Reply

      Hi, Matt. Our plugin allows you to display/list/show your WooCommerce orders in the front end of your website. To export this data, you can use a WooCommerce order export plugin, which has a feature that allows you to display an export button in the front end. Thanks.

  4. SAMEDI AMBA
    September 1, 2019 Reply

    Can I print the results of a query, or must I seek the services elsewhere?

    • EJ
      September 5, 2019 Reply

      Unfortunately, it's not possible to print query results from using the search box. To do that, you would need to use the options that come with WooCommerce Product Table to refine the orders displayed (See Choosing which products appear in the table), and then simply use the Edit -> Print function in your browser to print the current page, and that will only print the products that appear in the table when it first loads.

  5. Bryan Assata
    April 26, 2019 Reply

    How many filters can you apply, and can the filters be used with custom "meta" columns?

    • Katie Keith
      April 30, 2019 Reply

      You can add as many filter dropdowns as you like above the table. Posts Table Pro supports filters for categories, tags and any custom taxonomy, but of course you can only create filters for information that are used for the orders post type created by WooCommerce.

  6. Alessandro Putera
    March 25, 2019 Reply

    Hi, I already bought this plugin, I just want to ask, how to display the name of the product that has been ordered. Thank you.

    • Katie Keith
      March 26, 2019 Reply

      Hi Alessandro, you can find advice about the best way to do this in the 'Can I list the products for each order?' section of the above article.

  7. Yvonne
    January 10, 2019 Reply

    I'm currently using the plug-in and have two questions:
    1. We are using custom order numbers (via Custom Order Numbers for WooCommerce). Is there a way to show that information in the table?

    2. I understand linking to the view order page for the customer takes custom programming. Can you point me to any documentation, or to the right file, where this program would need to take place?

    Much thanks,
    Yvonne

    • Katie Keith
      January 11, 2019 Reply

      Hi Yvonne.

      1. You would need to check how the Custom Order Numbers plugin stores the custom order numbers. If it's a custom field attached to the 'Orders' post type then you will be able to use these instructions to list them in the table.

      2. Unfortunately we haven't done this piece of work ourselves, so I don't have any information about how to do it that I could give you. If you don't have a developer who can do this for you, then I recommend that you post a job on Codeable where their pre-approved WordPress experts will send you a quote. We have partnered with them to provide plugin customizations for our customers.

      • Yvonne
        January 11, 2019 Reply

        Thanks, Katie. I figured out #2 and am working on #1.

        • MD Nazmus Sakib
          April 25, 2020

          Hello there
          Can you please tell me how did you managed to figure out #2

          Thanks in advance

  8. Matthew
    January 10, 2019 Reply

    Hello Katie!

    Can you tell me if this plugin will allow me to not show any orders until I submit a search query?

    We have a customer service staff that it'd be best if not ALL of the orders were immediately available to them.

    For instance, a search bar that if a customer calls up, they can say "Hey my name is Firstname Lastname, and I placed an order, and I was wondering if it shipped yet."

    Then, the customer service person can type in "Lastname" and see any orders with that last name, and I'll put in the field for tracking info".

    Is that possible?

    • Katie Keith
      January 10, 2019 Reply

      Hi Matthew, unfortunately the search box only looks within the contents of the table and it's not possible to search before the products load.

      • Matthew
        January 21, 2019 Reply

        Hello Katie,

        So, for clarification, if I have 14k orders, I have to list all of them.

        On your screencap example, you have something that says "display 25 entries", and at the bottom it says "Showing 1-7 of 7 entries*.

        So, If someone were to say... have 26 orders, and it was set to display 25 entries, and someone ran a search, it would only search the 25?

        I guess I don't understand the purpose of the plugin, then perhaps.

        If I have it set to display 25 orders, but I have 100 orders total, if I wanted to search them all, it would only search the top 25?

        Can you please explain? Because having 14k orders listed on the page would definitely slow it down.

        Thanks!

        • Katie Keith
          January 21, 2019

          Hi Matthew, to be honest this is not the main purpose of the plugin - it's a fringe use case and Posts Table Pro is mostly used to list other types of information such as pages, posts or documents. This tutorial is about how to use Posts Table Pro to list WooCommerce orders because some people use it for that. It's not ideal as I mentioned in the article, so you need to read it carefully to make sure it's suitable. For example, you can't display orders for a specific user only - which means it may not be what you're looking for. People tend to use it to provide a front end way for their colleagues (who may not have admin access) to view orders, e.g. kitchen staff in a restaurant might use it on a password protected page.

          To answer your question more specifically - you can choose how many rows to include on each page of the table (the default is 25). Regardless, the search box will always look for ALL the orders in the table - not just the first 25.

          It sounds like I misunderstood your previous question - I thought you wanted to limit the total number of orders in the table, but I now realise that you just want to limit how many appear on each page, which is fine and won't affect the searching.

          So you can list 14k orders in a single table and if you use the lazy load option, then only the first 25 (or however many you choose to display per page) will ever load at one time. That's why it won't slow it down.

      • Matthew
        January 21, 2019 Reply

        Hey Katie,

        I guess then I'm not sure if I understand the purpose of the plugin.

        Can I limit it to only show 5 orders at a time or something that doesn't display the 14k orders that I have in my system?

        Similarly, if I only show 10 orders at a time, when I do a search, will it search only those 10 items that default, or will it search all 14k orders, and give me the 10 options that match my query?

        Thank you!

        This might be the closest thing to what I need.

        • Katie Keith
          January 21, 2019

          Hi Matthew, you can use the post limit option in the plugin to just show 5 orders at a time. However when you search the table, it will only look for the orders that you are actually displaying. So it might be best to enable the lazy load option which allows you to list all 14k orders without performance problems - that way, the search will look at ALL orders.

  9. Carlos Tapia
    November 22, 2018 Reply

    With this plugin is it possible that my clients (Registered people who buy on my website) have a report of their purchases per product (totals), not per order, in x period?
    Thank you

    • Katie Keith
      November 22, 2018 Reply

      Hi Carlos, unfortunately it's only possible to list the information mentioned in this tutorial. It's pretty restrictive due to the way that WooCommerce stores information about orders.

  10. Yannis Baritakis
    November 19, 2018 Reply

    Hello,
    Is it possible to list in one page orders from a bilingual site? In other words to display orders that where made in English and French store together.

    Thanks

    • Katie Keith
      November 19, 2018 Reply

      Hi Yannis, it depends on which multi-lingual plugin you are using. If they are stored in the same database table then you should be able to list them in a single table on the front end, although I haven't tested this.

  11. Junami Junami
    April 26, 2018 Reply

    Hi,
    I am using the [my_orders] shortcode but it is not working..

    • Katie Keith
      April 26, 2018 Reply

      Hi Junami, that's strange as this shortcode is part of WooCommerce itself. You would need to contact woocommerce.com support if it's not working on your site.

  12. Daniel
    April 25, 2018 Reply

    Hi there,
    I have a pre-sales question. Is it possible to also include the order action buttons on the front end (to mark the orders as "Complete" or "Cancelled")? So that the order status can be changed without having to go into the back end?

    Thanks.

    • Katie Keith
      April 25, 2018 Reply

      Hi Daniel, I'm afraid this isn't possible (although you could probably do it via some extra coding if you know how to). You can only display the information mentioned in this tutorial.

  13. Muhammad Arsalan
    April 11, 2018 Reply

    Hello,

    Can you please tell me how can i show specific customer orders in datatable at Front end ?

    • Katie Keith
      April 11, 2018 Reply

      Hi Muhammad, unfortunately this isn't possible because WooCommerce doesn't store the customer against the order in a way that Posts Table Pro can display.

  14. Alexander
    February 7, 2018 Reply

    Katie Keith, Thanks for sharing this interesting tutorial but can you guide me how can i display the customer order information from orders as i have implemented some steps define in the tutorial https://www.wpblog.com/display-woocommerce-customer-order-details/ but i have been some where stuck in this code. Can you guide me on this

    add_action( ‘woocommerce_admin_order_data_after_billing_address’, ‘blog_anothermethod_display’);
    function blog_anothermethod_display( $order ){
    $order_id =43;
    $order_meta = get_post_meta($order_id);
    print(“”);
    print_r($order_meta);
    print(“”);
    }

    • Katie Keith
      February 7, 2018 Reply

      Hi Alexander, I'm sorry but I can't help you with this. If you don't have a developer who can do this for you then I recommend that you post a job on Codeable - they have lots of excellent developers who specialize in this sort of customization.

Please share your thoughts...

Your email address will not be published.