Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- require('wp-blog-header.php');
- require_once("wp-config.php");
- require_once("wp-includes/wp-db.php");
- global $woocommerce;
- $args = array(
- 'post_type' => 'shop_order',
- 'post_status' => 'any',
- 'posts_per_page' => -1,
- 'tax_query' => array(
- array(
- 'taxonomy' => 'shop_order_status',
- 'field' => 'slug',
- 'terms' => array('complete')
- )
- )
- );
- $loop = new WP_Query( $args );
- while ( $loop->have_posts() ) : $loop->the_post();
- $order_id = $loop->post->ID;
- $order = new WC_Order($order_id);
- list( $name, $undef ) = explode("<br/>", $order->get_billing_address());
- list( $firstname, $lastname ) = explode(" ", $name);
- $billing_email = $order->billing_email;
- $order_total = $order->order_total;
- $cart_discount = $order->cart_discount;
- $user = get_user_by('id', $order->user_id);
- $customer_email = $user->user_email;
- $user_id = get_user_id($firstname, $lastname, $billing_email, $customer_email);
- print "$firstname $lastname";
- endwhile;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement