I wish to filter the items printed, or change their order

This requires version 2.7.13 or later (August 2018) of the plugin.

The code sample below sorts order items by SKU. A competent PHP developer will easily be able to adapt this to fulfil other requirements (e.g. sort in a different way, or omit unwanted items). Please note that our general FAQ on customisations applies.

<?php

// This code sample is not compatible with WooCommerce 2.x
add_filter('woocommerce_printorders_print_order_items', 'my_woocommerce_printorders_print_order_items');
function my_woocommerce_printorders_print_order_items($order_items) {

  if (is_array($order_items)) {
    uasort($order_items, 'my_print_order_sorting_function');
  }

return $order_items;
}

// This function sorts based on SKU
function my_print_order_sorting_function($a, $b) {

  // Confirm that both items are order product items
  if (!is_a($a, 'WC_Order_Item_Product')) return is_a($b, 'WC_Order_Item_Product') ? 1 : 0;
  if (!is_a($b, 'WC_Order_Item_Product')) return -1;

  $product_a = $a->get_product();
  $product_b = $b->get_product();

  // Confirm that both products exist
  if (!is_a($product_a, 'WC_Product')) return is_a($product_b, 'WC_Product') ? 1 : 0;
  if (!is_a($product_b, 'WC_Product')) return -1;

  // In this example, we sort via SKU
  return strcmp($product_a->get_sku(), $product_b->get_sku());
}

Posted in: WooCommerce Google Cloud Print Automatic Printing