WooCommerce: Output a printable list of processing orders

· · ·

screen-capture

Someone requested a way to print out a list of their processing orders for WooCommerce so I came up with a snippet to do so 🙂

The code below can be added as a page template in your theme. Once added to your template, just create a page in WordPress admin and assign it the “Print processing orders” page template.

Theres a check at the top of the page to only let admin users in, and when viewed the page will give you a nice list of processing orders which you can then print out.

<?php
/*
Template Name: Print Processing Orders 🙂
*/
if (!is_user_logged_in() || !current_user_can('manage_options')) wp_die('This page is private.');
?>

body { background:white; color:black; width: 95%; margin: 0 auto; }
table { border: 1px solid #000; width: 100%; }
table td, table th { border: 1px solid #000; padding: 6px; }
article { border-top: 2px dashed #000; padding: 20px 0; }

<?php

global $woocommerce;

$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('processing')
		)
	)
);

$loop = new WP_Query( $args );

while ( $loop->have_posts() ) : $loop->the_post();

$order_id = $loop->post->ID;

$order = new WC_Order($order_id);

?>

Order # &mdash; ">

get_subtotal_to_display(); ?>

order_shipping > 0) : ?>

get_shipping_to_display(); ?>

order_discount > 0) : ?>

order_discount); ?>

get_total_tax() > 0) : ?>

get_total_tax()); ?>

order_total); ?>  payment_method); ?>

email_order_items_table(); ?>

billing_email) : ?>
billing_email; ?>

billing_phone) : ?>
billing_phone; ?>

get_formatted_billing_address(); ?>

get_formatted_shipping_address(); ?>