add order date to Order Printer?

Solved

add order date to Order Printer?

lfern
Tourist
4 0 1

When using Order Printer, there's a "print date" displayed in the corner. How can I add an "order date" to the same area? I tried using this:
Order Date {{ order.created_at | date: "%m/%d/%y" }}<br />

 

But that only displays the words "Order Date" and doesn't show the date the order was created.

Accepted Solution (1)
MakP
Shopify Partner
33 9 14

This is an accepted solution.

Apologies. I've been so focused on that new disaster of an app that I just assumed you were talking about the new version. This is the code I was using for order date in my legacy template: "{{ date | date: "%m/%d/%Y" }}"

View solution in original post

Replies 7 (7)

MakP
Shopify Partner
33 9 14

Odd. {{ order.created_at | date: "%m/%d/%y" }} seems to be working fine for me. Although I will mention that I actually thought this wasn't working at first because I was testing it on orders that were placed today - I realized it was working properly when I tested it on an order placed in the past. Is it possible you've made the same mistake I did?

 

If it's still not working, perhaps posting your entire template code would help to diagnose the issue.

 

I've heavily modified my default template, so I won't post the whole thing, but this is the block that contains the order date:

<li>
    <span>Order Date</span>
    <span>{{ order.created_at | date: "%m/%d/%Y" }}</span>
</li>

 

lfern
Tourist
4 0 1

Thank you for the response! I tried to save a previous order as a PDF and the order date doesn't appear:

Order Date Not Printing.png

 

Here is my code:

 

<p style="float: right; text-align: right; margin: 0;">
Print Date {{ "now" | date: "%m/%d/%y" }}<br />
Invoice for {{ order_name }}<br />
Order Date {{ order.created_at | date: "%m/%d/%y" }}<br />
</p>

MakP
Shopify Partner
33 9 14

Well that's certainly odd. I know I'm not completely insane at least because I'm using the code snipped I posted earlier in our own order printer template and it seems to be working fine for us: 

MakP_0-1716237400855.png

I have noticed that the new order printer app seems to really dislike float styling. Perhaps try deleting the "float: right;" styling from your <p> container and see if that changes anything?

lfern
Tourist
4 0 1

I haven't switched to the new order printer yet; this is all happening with the Legacy printer.

MakP
Shopify Partner
33 9 14

This is an accepted solution.

Apologies. I've been so focused on that new disaster of an app that I just assumed you were talking about the new version. This is the code I was using for order date in my legacy template: "{{ date | date: "%m/%d/%Y" }}"

lfern
Tourist
4 0 1

That worked!!! Thank you VERY much for supplying that code!! 

Daniel2help
Shopify Partner
21 0 1

 

Hey @lfern,

 
You can surface dates to Order Printer Pro  / ShipStation via apps like Flare - Delivery Date Picker.

 

Here's the Liquid, if needed (or the order attributes can be passed via API too):

 

 
 {% if attributes.__flare_delivery_date %}
<p>Estimated delivery: {{ attributes.__flare_delivery_date | date: "%A, %B %d, %Y" }}</p>
{% endif %}
 

This ensures any delivery or ship date collected at checkout (stored via order.attributes) shows up on your printed invoices, order confirmation or packing slips.

 
Daniel
Co-founder at Flare: Delivery Date Picker