question

Lee Tickett avatar image
Lee Tickett asked Lee Tickett answered

Can we print an order receipt with only selected lines?

We are currently using something like;
new StaticOrderPrintJob.Builder().order(order).build().print(); 
But would like to be able to only print certain order items. Is this possible?
But would like to be able to only print certain order items. Is this possible?
OrdersPrint
1 comment
10 |2000

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

Lee Tickett avatar image Lee Tickett commented ·

I have found StaticOrderPrintJob.Builder().itemIds() to take a look at, but guessing it may only allow specifying which inventory items rather than which order lines... I Will report back how I get on!

0 Likes 0 ·

1 Answer

Lee Tickett avatar image
Lee Tickett answered
I think I cracked it. I just modify the order "in memory" before passing it to the print job;

List<LineItem> items = order.getLineItems();
List<LineItem> modifiable = new ArrayList<>(items);
modifiable.remove(0);
order.setLineItems(modifiable);
new StaticOrderPrintJob.Builder().order(order).build().print()
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