How can I display invoice numbers on Order Printer using Metafield?

How can I display invoice numbers on Order Printer using Metafield?

jdj
Visitor
3 0 1

Hi there,

I use Order Printer to print out invoices.

 

I created the single-line-text Metafield   order.metafields.my_fields.invoice_number   to assign invoice numbers to each order to complement the order numbers that Shopify already generates.

 

How can I make the invoice number appear on the print?

I've tried so many solutions offered on this forum, but all were without success. Would greatly appreciate some help to edit the template correctly. Thank you in advance!

Replies 6 (6)

Darren-Bull
Excursionist
16 0 2

Hello,

 

Did you manage to solve this as I have the same requirement and I am also failing to output my metafield.

 

Regards,

Darren.

jdj
Visitor
3 0 1
Dear Darren,
Thank you for your message - it shows that is not just me that's having
this problem 😉
No, I haven't been able to find a solution to this until now.
It would be great though!!

hdfdp
Visitor
2 0 2

I too am in need of a solution to this. I have a metafield for orders that allows me to add a Purchase Order number to a given order if required. I am able to conditionally add this to the email order invoices, but I cannot seem to access this metafield through Order Printer.

 

Hoping someone has stumbled on a solution....

Darren-Bull
Excursionist
16 0 2

Unfortunately I am also still looking for a solution to this 🙄

Teed
Tourist
3 0 0

How do you add PO number to emailed invoice?

hdfdp
Visitor
2 0 2

For emails, I have added a new metafield in store settings as per the first post. (in my case, its just "custom.purchase_order_number" with appropriate description )

Then under "notifications" in settings, I edited the "order invoice" and "draft order invoice" templates to to conditionally show the PO number if it has been set for an order.

 

{%- if order.metafields.custom.purchase_order_number %}
<br/><span class="order-number__text">
Purchase Order No: {{ order.metafields.custom.purchase_order_number }}
</span>
{%- endif %}

 

Specifics of the template will vary based on what you already have, but that is the gist of it.

 

With Order Printer app, I have just made use of the "Notes" field in orders to add something like "PO Number: xyznb12" and highlighted that in the template. Not ideal but it will do until we can use custom metafields here instead. Could technically use the "Notes" field for both email and printed invoices, but then it means you need to be careful what you put in that field for all orders.