Ask your WordPress questions! Pay money and get answers fast! (more info)

Print List of Woocommerce orders for specific product WordPress

  • SOLVED

Hi

There currently does not seem to be a way of exporting or printing a list of sales for a specific product in Woocommerce. I have found this

http://mikejolley.com/2011/11/woocommerce-output-a-printable-list-of-processing-orders/

which works really well but I am unsure how to change the query to search for a specific product or even a product category slug might suffice.

Currently the query is $args = array(
'post_type' => 'shop_order',
'post_status' => 'publish',
'posts_per_page' => -1,
'tax_query' => array(
array(
'taxonomy' => 'shop_order_status',
'field' => 'slug',
'terms' => array('on-hold')
)
)
);



What would be ideal would be a way to have a drop down on the page of products or Product categorys which upon selecting the printable list is created.

Or indeed any other ideas on how I might achieve this? I have found an export CSV plugin but I can not specify product and it does not give me the detail I need.

Big thanks
Jen

Answers (3)

2013-04-19

Daniel Yoen answers:

I am litle confused here :-), but, you can try this :

$args = array(
'post_type' => 'shop_order',
'post_status' => 'publish',
'posts_per_page' => -1,
'tax_query' => array(
'relation' => 'AND',
array(
'taxonomy' => 'shop_order_status',
'field' => 'slug',
'terms' => array('on-hold')
),
array(
'taxonomy' => 'category',
'field' => 'slug',
'terms' => array('your-category-here')
)
)
);


Jennie Routley comments:

Thank you - apologies for not being clearer. I did try this and alas it did not work, but it did lead me to think a bit more about how the data is pulled in. As I want a list of orders by order-item - I realise that the Order Item (product) is infact a custom field in the order page on the admin side. Does that help at all?

Basically I am creating a site that takes bookings for courses rather than actual physical products and so I wanted a way to see exactly who has booked onto each course (product). I can do a search in the admin side via woocommerce but it I have to click into each order to see the details, I was hoping there would be a way I could list out all the details in a printable format somehow.

Thanks so much for your help,
Jen


Daniel Yoen comments:

you can try post meta to do that, you can create post meta like : ordered_by. then you can filter by post meta to display post and also you can display user list that ordering your products :-)

hope this help

2013-04-19

Arnav Joy answers:

is the current query working perfectly ? you need to make it dynamic , right?


Jennie Routley comments:

Hi

Thanks, the current query only pulls in orders that are in the status "processing" - whereas I would like it to pull in orders based on a product or product category, I am not bothered about the status, so I was thinking there must be a way to change the query to fit my needs. Ideally product, but if that is not possible then category is ok.

For that to be dynamic would be even better :)

Thanks
Jen

2013-04-19

Yakir Sitbon answers:

I can write you code to use with "checkbox" and select multiple orders for print format, but for that i do not think 20$ would be enough.

You can PM me about more info.

Yakir.