Dan avatar image
Dan asked Jeffrey Blattman answered

Printing programmatic messages on Order receipts

I am aware of SmartReceipts and have examined the ReceiptRegistrationTestActivity and ReceiptRegistrationTestProvider classes which seem to use deprecated constructors to print a receipt on a button click using the print() function.

The javadocs have a few more clues that you can print views and text now using the same print() function.

It looks like half of the printing classes are deprecated and the other half are now geared towards using the builder constructor pattern. My question is, can we print programmatic text on the bottom of a standard order receipt?

It looks like there is a StaticOrderPrintJob for printing items, a StaticReceiptPrintJob for printing orders, a TextPrintJob for printing a standalone receipt with custom text and a ViewPrintJob for printing a standalone View. If this is all the options covered, then it looks like it is not possible but I'd like to here it from you guys :)

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

Jeffrey Blattman avatar image
Jeffrey Blattman answered

The non-static print jobs are deprecated because we moved to a model of having the print job contain all information required to print the receipt, as opposed to looking up data at print time (think storing an entire Order object vs. storing on the order ID and looking up the Order at print time).

You can use the receipt registration mechanism to add arbitrary text or images to the bottom on customer receipts (not order receipts). The publicity of this is dubious. It was never 100% made public and is technically replaced by smart receipts. It has the limitation that web receipts will not have the additions.

Is there a reason why you can't use smart receipts?

10 |2000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Welcome to the
Clover Developer Community