How can I print to more than one printer, or print only if further conditions are fulfilled?

You can choose as many printers as you like, using the settings in your WordPress dashboard in WooCommerce -> PrintNode -> Settings:

Configure copies per-printer

If you want to filter orders in a more complicated way, so that orders go to a printer only sometimes (depending on something to do with the order itself) then you will need to do a little custom PHP development for this, in order to implement the logic of your particular requirements. (i.e., you’ll either need to write a little PHP code yourself, or hire a PHP coder – somewhere like codeable.io or freelancer.com is an option if you don’t already have a developer. Please note that customised development isn’t part of your plugin purchase – i.e. we can’t contribute time to do this for you as part of your purchase. However, we’ve done 90% of the work for you, below).

The way to do it is to use the woocommerce_printorders_printnode_copies filter. Using the passed parameters, you can apply arbitrary criteria based upon anything you like concerning the order. Here is a code fragment to start your developer off with:

<?php
add_filter('woocommerce_printorders_printnode_copies', function ($copies, $order, $printer_id, $source, $source_info, $printers) {

	// Get the order details
	$order_meta_data = $order->get_meta_data();
	
	/*
	Do something based on the order, according to what you require...
	
	if ($order_meta_data['key'] ... ) {
		// Suppress this print job (print no copies)
		return 0;
	}
	*/
	
	// If our conditions did not match, then leave things as they were
	return $copies;

}, 10, 6);

 

Alternatively, to suppress all automatic printing (so that printing is manual-only):

add_filter('woocommerce_printorders_printnode_print_on_payment_complete', '__return_false');
add_filter('woocommerce_printorders_printnode_print_order_now', '__return_false');

 

Posted in: WooCommerce Automatic Order Printing (PrintNode)