Skip Navigation

[Resolved] Woocommerce orders

This support ticket is created 9 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 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 9:00 – 18:00 -
- - - - - - -

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

This topic contains 14 replies, has 8 voices.

Last updated by Vito Peleg 9 years, 10 months ago.

Assigned support staff: emerson.

Author
Posts
#79675

Hi,
I'd like to include the woocommerce orders in one of my queries. I can see a post type of shop_order with an entry for each order number, but this is not visible to my views. Is there anything I can do to be able to query this post type?

Thanks,

#79862
order.jpg

Dear Simon,
I think it's possible to query the Woocommerce shop_order post type in Views. I have tried it now and it uses "Orders" under what type of content to load. See the attached screenshot. Please let me know if you are satisfied with my answer and if I can help you with any other questions you might have.

Cheers,
Emerson

#84445
Edit View ‹ My Blog — WordPress.png

Hi Emmerson,
I have two site with woocommerce installed and neither show the orders type. I just get products, Variations and Coupons added as types. I am using the lastest versions of all plugins.

Thanks,

#84452

Dear Simon,
Have you check that there are already completed and published orders data made by Woocommerce as shown here: hidden link
Replace "yoursite.com" with your URL.

Cheers,
Emerson

#84473

Yes, I have test orders on both sites with a variety of states (including processed and completed). On one site I do have a woocommerce subscriptions installed , but the other is just vanilla woocommerce, types and views.

#84500

Dear Simon,
Thanks for your feedback. I would like to replicate this problem in my localhost. Can you confirm that you are using the following versions?

Types 1.2.2
Views 1.2.1
WordPress 3.5.1

Also please indicate your Woocommerce and Woocommerce Views version.
Do these test sites available online? Probably I can login and see this issue. Please send the login details to my email.

Cheers,
Emerson

#84522

I can confirm that thos are the versions I am using along with woocommerce 2.0.8 and WooCommerce Views 1.2.1

I've just sent you an email with login details.

Thanks,

#84552

Dear Simon,
Thanks for the login details. I think there is an incompatibility issue between WooCommerce 2.0.8 and Views 1.2.1. I tested on my localhost using WooCommerce 1.6.5.1: hidden link with Views 1.2.1 and Types 1.2.2 and the Orders post type appears in the View query options (like on my screenshot shown previously). WooCommerce 1.6.5.1 is the version used by Discover-wp for Views WooCommerce site example.

However as I upgrade WooCommerce to version 2.0.8 , Orders post type disappear from the View query options (like in your case). This would reappear if WooCommerce is downgraded to 1.6.5.1. I will report this issue to the developers.

Cheers,
Emerson

#84565

Thanks Emmerson - It's not only 2.0.8 as I've been through a few upgrades now - I suspect it's in all the 2.0.0+ versions.

#121308

Same problem running WooCommerce 2.0.13

#135849

Same problem over here. Waiting for a fix

#141316

I have the same Issue here, how could that be resolved?

#151459

Same issue with latest Views and WooCommerce 2.0.18

#151987

Juan
Supporter

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

Hi all.

This is Juan from Views dev team.

WooCommerce changed the settings from its custom post types when upgrading to version +2.xx. As a result, Orders are now marked as a non public post type. In Views we only offer public post types to build queries upon, and by now we have no plans to change it.

We might find a workaround for this, but there is no scheduled timing for this.

Regards,
Juan de Paco

#419940

To change the orders back to public, you can add this code in your functions.php

/**
 * Changing woo orders back to public so that we can manipulate with toolset and gravity forms
 */
add_filter( 'register_post_type_args', 'change_capabilities_of_the_custom_shop_order_posttype' , 10, 2 );

function change_capabilities_of_the_custom_shop_order_posttype( $args, $post_type ){

 // Do not filter any other post type
 if ( 'shop_order' !== $post_type ) {

     // Give other post_types their original arguments
     return $args;

 }

 // Change the public toggle of the "shop_order" (woo orders) post_type
 $args['public'] = 'true';

  // Give the shop_order post type it's arguments
  return $args;

}