Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using woocommerce for a "multi-seller" system. Meaning one site (no multi-site), but many sellers with different products.

To let each owner only manage it's own orders, it would like to filter all orders before they are shown in the admin area. The criteria for filtering could be a tag or the creator of the product.

Is there a hook or filter to create the desired result? If not, what else could be a solution?

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted
+50

WooCommerce does not support this specific scenario. The primary issue in this case being that WooCommerce processes orders at the order level NOT the line item level.

So if a customer were to order items from multiple sellers you create a situation that will cause serious problems and headaches. When the first seller marks the order as processed the entire order (each and every line item) is also marked as processed. Even if the seller of the second or subsequent line item(s) haven't processed the order.

Those items would never be made, packed, or shipped.

That being said you can filter the WooCommerce admin order view by using woocommerce_custom_order_views(). You can see the documentation at http://wcdocs.woothemes.com/apidocs/function-woocommerce_custom_order_views.html

Since products are 'posts' each product has a post_author that would equate to the author/creator of the product. Each order has a serialized list (wp_postmeta._order_items) of the line items, including the line item's wp_posts.ID

So with a bit of work you could determine which orders contain items created by a specific seller (user), then filter the display appropriately.

share|improve this answer
    
Thx for your suggestions and your additional notice. I do hope I am not asking the obvious, but where do I hook into, to customize the orders query? –  SunnyRed Nov 3 '12 at 19:04
1  
Honestly not had call to do this do I don't have a specific answer. But rather than the woocommerce_add_custom_query_var() I mentioned I found this filter: woocommerce_custom_order_views. I think it would be a better match for what you're trying to do. Check the WooCommerce API docs at wcdocs.woothemes.com/apidocs/… as a starting point. –  Stephen Nov 3 '12 at 21:01
    
Certainly all in all this isn't what I was hoping for, but it is what it is. Nevertheless once again thanks for your explanation and the time you have put in. –  SunnyRed Nov 8 '12 at 13:52
    
You're welcome Sunny –  Stephen Nov 8 '12 at 14:02
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.