My checkout has slowed down. How can I send to Google Cloud Print in the background?

In versions of the plugin from 2.7.20 onwards (May 2019), the default behaviour for the plugin is to check that the WP Cron system appears to be working, and if it is, is, to print via cron (i.e. in the background). Printing only happens in the foreground if it looks like WP Cron is not working (too many overdue jobs). In all cases, the filter mentioned below can still be used to force one way or the other. Also, from 2.7.22 onwards (June 2019), Action Scheduler is preferred to cron if it is available (which it is if you have WooCommerce 3.5 or later).

The may plugin prints orders during the customer’s placement of the order. i.e. Whilst WooCommerce is receiving the order and processing it, and generating the “Thank you” page for the browser, the sending of a print job to Google Cloud Print is one of the tasks carried out. This was the default behaviour before version 2.7.20 (May 2019). Because this involves talking to the network, and generating a PDF to print, this can take a few seconds. The customer then spends a few more seconds looking at the spinning graphics on the checkout page.

If you prefer to instead have the print job performed in the background, then you can do that via this code fragment (add it to your functions.php, or as an mu-plugin):

add_filter('woocommerce_print_orders_via_cron', '__return_true');

With this tweak, instead of printing immediately, the plugin will instead schedule a task (for a few seconds ahead) in WordPress’s “scheduled task” system. WordPress will then call this task in the background. For this to work, WordPress’s scheduled task system needs to be working on your website. That is the reason why this option is not the default…. a very small percentage of WP installs have a broken task system (sometimes deliberately – e.g. Heart Internet in the UK for many years have turned it off for all their customers). To investigate the scheduled task lists in your system, you can use this free plugin: https://wordpress.org/plugins/wp-crontrol/. Please note that investigating your WP’s scheduled task system is not something we can do as part of our standard support.

Posted in: WooCommerce Google Cloud Print Automatic Printing