Google Cloudprint
Filters available using WPPizza Google Cloudprint
wppizza_gcp_filter_copies
Sending the second copy of an order to a different printer (id) set in the same google cloudprint account. The Number of copies in the plugin settings WPPizza->Cloudprintmust be set to 2 or more for this to have any effect.
@param: str (printer id)
@param: int (current copy )
@param: int (order id )
@param: array (order formatted )
@param: array (plugin options)
@return: str (printer id)
add_filter('wppizza_gcp_filter_copies', 'myprefix_gpc_set_printerid', 10, 5);
function myprefix_gpc_set_printerid($printer_id, $copy, $order_id, $order_formatted, $gpcOptions){
/* set a different printer id for the second copy */
if($copy==2){
$printer_id = 'some-printer-id-you-need-to set';/* set the printer id here */
}
return $printer_id;
}
wppizza_gcp_filter_printerid
If you do not need to or want to send multiple copies but simply want to set a dynamic printer id depending on some parameters received, you can try something like this
@param: str (printer id)
@param: int (order id )
@param: array (order formatted )
@param: array (plugin options)
@return: str (printer id)
add_filter('wppizza_gcp_filter_printerid', 'myprefix_gpc_set_printerid', 10, 4);
function myprefix_gpc_set_printerid($printer_id, $order_id, $order_formatted, $gpcOptions){
/* set a different printer id for the second copy */
if($order_formatted['some']['key']['selected']=='some value'){
$printer_id = 'some-printer-id-you-need-to set';/* set the printer id here */
}
return $printer_id;
}