Skip Navigation

[Resolved] Woocommerce Order View Displays all orders

This support ticket is created 4 years, 10 months 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 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 3 replies, has 2 voices.

Last updated by Luo Yang 4 years, 10 months ago.

Assisted by: Luo Yang.

Author
Posts
#1272033

Hello I am trying to display orders on the product page that belong only to that particular product. I am trying do that with a toolset view. For some reason I can't show only the orders to that belong to that partucular product. Instead all orders are shown. Any idea why?

#1272195

Hello,

There isn't such a built-in feature within Toolset plugins, since Woocommerce plugin is using a custom database table "wp_woocommerce_order_itemmeta" to store the product ID for order post, it is out the range of Toolset or even WordPress range.

In your case, you might consider custom codes, I have searched it in google, and found this thread:
https://stackoverflow.com/questions/45848249/woocommerce-get-all-orders-for-a-product

For your reference.

#1272231

Thanks,
what about this?
[wpv-conditional if="( wpv_woo_product_belongs_to_this_order() eq '1' )"]

#1272381

The wpv_woo_product_belongs_to_this_order() is a PHP function, you can follow our document to setup the [wpv-conditional] shortcode:
https://toolset.com/documentation-category/woocommerce-views/
section "Displaying customers associated with WooCommerce orders"

But I don't think it is a good idea, since that post view, will query all order posts each time, and then in the loop display the items by [wpv-conditional] shortcode, if there are lots of order posts in your website, it will conduct the performance problem.

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.