add order date to Order Printer?

Solved

add order date to Order Printer?

lfern
New Member
4 0 0

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 13

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 6 (6)

MakP
Shopify Partner
33 9 13

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
New Member
4 0 0

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 13

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
New Member
4 0 0

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

MakP
Shopify Partner
33 9 13

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
New Member
4 0 0

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