Automatically send a fax when a WooCommerce order status changes to processing. Additionally, create and store label data for remote printing to a thermal label printer.
TrueGarden.com had an existing, custom-coded system for incoming WooCommerce orders. It extracts elements to be packed and shipped from another location and creates a specially formatted packing list of those elements, which is then printed and manually faxed to the warehouse. I was tasked with adding a feature to automatically fax the packing list to the warehouse directly once an order’s status changed to ‘processing.’ Additionally, some of the items to be shipped required custom labels to be printed to a thermal label printer. The setup required the printer to be connected directly to a desktop computer via a USB cable and located in the warehouse. It could only receive printing instructions through that computer via specially formatted text files fed directly either from the command line or a proprietary application. Finally everything had to be as automated and simple as possible for the end user.
I accomplished the goal by creating the text files for the labels simultaneously with the packing list and storing them in a folder local to the website for future download. The packing list is immediately and automatically faxed using an inexpensive online service. When the labels are needed, the warehouse manager presses a button from a dedicated administration page, which automatically downloads all the label files and then calls a DOS batch file to feed them to the thermal label printer. Upon success, the records are archived for future re-printing if needed. The archive is auto-maintained by the code to store records for 6 months and includes tools to reprint labels from past orders or print custom labels.