Woocommerce - how to get a detailed list of product orders

This is a feature whose absence in the WC shock me. I need to choose a product and get a list of all the customers who purchased it! Sounds like an obvious necessity, but I can't even find a plugin for this.

In particular, we sell tickets to enter the event, and we need to be able to print a list of names that can be used by people working at the door - they need to see if the person is on the list.

I am a php guy and can learn to write a plugin, or just add a hook to functions.php.

One solution would be to add a custom column to the order page that displays the product name — then you can sort by that column. This should be relatively easy, and he will do his job, albeit inefficiently.

If I could write a plugin that integrates into the product details pages and provides a purchase report, that would be nice.

What is a clean way to get this information?

+3
source share
1 answer

It may be late, but I'm sure it will help someone. I ran into the same requirement as the OP, and I could not find any solution. Thanks to GOD. I know a bit of coding, so here is my workaround.

: , i.e "content-single-product.php", IDS . , .

       $orderIDs = get_post_meta(get_the_ID(), "orderids", true); 
       foreach($orderIDs as $IDs)
       {
           if(!empty($IDs)){
                   echo "<p>".$IDs."</p>";          
                   $orderInfo = new WC_Order( $IDs );           
                   echo "<p>".$orderInfo->billing_first_name."</p>";       
                   echo "<p>".$orderInfo->billing_email."</p>";            
           }
       }

"billing_first_name" "billing_email" - -, "wp_usermeta" . .

, post .

, , , . , - . .

0

All Articles