Skip to content

Instantly share code, notes, and snippets.

@hedqvist
Last active August 24, 2020 08:19
Show Gist options
  • Select an option

  • Save hedqvist/b46deed6b5ad17fb6da0ae61413f0d23 to your computer and use it in GitHub Desktop.

Select an option

Save hedqvist/b46deed6b5ad17fb6da0ae61413f0d23 to your computer and use it in GitHub Desktop.
Automatic Printing - Different printer for packingslip
<?php
/**
* @snippet WooCommerce - Print to different printerID if we are printing a packingslip
* @author Redlight Media AB / Christopher Hedqvist
* @compatible WooCommerce 4.4.0
*/
function redlight_print_packingslip_to_custom_printer($printjob, $order) {
if( strpos($printjob['title'], 'Packingslip') !== false) {
$printjob['printerId'] = 123456;
}
return $printjob;
}
add_filter('redlight_wc_automatic_printing_data', 'redlight_print_packingslip_to_custom_printer', 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment