Skip Navigation

[Résolu] View of Woocommerce orders

Ce fil est résolu. Voici une description du problème et la solution proposée.

Problem: How to display a list of WooCommerce orders on the front end.

Solution: WooCommerce Orders are available in the Content Selection of a View when you have the WooCommerce Views extension installed.

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.

Marqué : ,

This topic contains 3 réponses, has 2 voix.

Last updated by Nigel Il y a 3 années et 6 mois.

Assigned support staff: Nigel.

Auteur
Publications
#621145

Tell us what you are trying to do? I need to make a view for the admin, listing all orders.

Is there any documentation that you are following? Yes, I understand I have to make the "order" post-type public.
I have used https://toolset.com/forums/topic/woocommerce-orders-4/ but the line number no longer corresponds to my version of Woocommerce, which is 3.3.3. Please point me in the right direction. I noticed that in views, I could select "orders" (why would that be if the post-type is private?) and I could also (since views version 1.8.0) filter by third party custom-statuses like wc-completed. So it seems that all this is almost supported. For security reasons I was planning to use Access for limiting access to the page that contains the order view.

Is there a similar example that we can see? No. It does not work yet.

What is the link to your site? As stated above.

#621371

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+01:00)

Screen Shot 2018-03-02 at 12.13.56.png

Hi there

With the Views integration with WooCommerce you do not need to make the Order post type public, you can use it directly in a View. (See screenshot.)

That works if you have the Toolset WooCommerce Views plugin installed.

#621473

Thank you, but I was already using that method. In the meantime I have found the reason for not getting any results. I was displaying fields which were not in the order post-type. I had assumed that "product" was a parent of "order" so that I could also display, sort and filter by product-fields. On further investigation it became clear that product is not a parent of order, but a parent of order-item. One order can have multiple order-items, each connected with a different product.

My ultimate goal is to display order-items, together with order-info and product-info (both parents). In this site, the products are training-events. We want to select those events that are in the past together with the orders in which they occur, so that we know which clients should receive a certificate. However, in views I do not seem to be able to select the post-type "order-items". Why is that? Once this becomes possible, how can I add information from both parent post-types?

#622031

Nigel
Supporter

Languages: Anglais (English ) Espagnol (Español )

Timezone: Europe/London (GMT+01:00)

WooCommerce has a custom post type "shop_order" for orders, but the order items are not posts, there is no such post type as order-items, which is why you cannot select it.

You will find a custom database table wp_woocommerce_order_items that stores the order items, and a related table to store item meta.

Custom tables are not accessible to Toolset. You can only access data from the standard WordPress tables such as wp_posts, wp_postmeta, and the taxonomy and user tables.