Add customer name to order printer invoice when using local pickup

Solved
Highlighted
Tourist
5 0 1

Hi,

I use the Order Printer app and print out the Invoice option.  I use that both as a checklist when packing orders and as a place to write a "thanks for the order" note for the customer.  I then include that with the customers order in the bag or box if it is being shipped.

Before the Local Pickup option came out, I had set up a shipping rate that was called "Pickup my order" and set the value to $0 so that local customers could have a way to come out to pickup their order instead of having it shipped.  It was great when the Local Pickup option came out, I was able to delete that shipping option and just use the local pickup option for my local customers.

The only thing I don't like about it is that it no longer puts the customers name on the invoice sheet that I print out since there is an "if statement" that keeps the customers name and address from bring printed, it only shows up if they choose shipping.  When I have four or five orders on the go and no names on any of them, it makes it hard to keep the orders straight as to who they belong to.

To get around that I just added a few lines to the template code to show the customers name:

...

{% if note %}
  <h3 style="margin: 0 0 1em 0;">Note</h3>
  <p>{{ note }}</p>
{% endif %}

/* below here are the few new lines I've added to make the new section */

  <h3 style="margin: 0 0 1em 0;">Customer:</h3>
  <div style="margin: 0 0 1em 0; padding: 1em; border: 1px solid black;">
    <strong>{{ customer.name }}</strong><br/></div>

  /* back to the original code below for shipping details */  

{% if shipping_address %}
  <h3 style="margin: 0 0 1em 0;">Shipping Details</h3>
  <div style="margin: 0 0 1em 0; padding: 1em; border: 1px solid black;">
    <strong>{{ shipping_address.name }}</strong><br/>
    {% if shipping_address.company %}
      {{ shipping_address.company }}<br/>
    {% endif %}
    {{ shipping_address.street }}<br/>
    {{ shipping_address.city }}
    {{ shipping_address.province_code }}
    {{ shipping_address.zip | upcase }}<br/>
    {{ shipping_address.country }}
  </div>
 {% endif %}

 

The problem with that though is now it is always there and repeats when someone chooses shipping as it shows both the customers name and shipping option.  It's not the end of the world but it bugs me and I'd like to add an if statement that would only make the new code show when the customer chooses the local pickup option (and not the shipping details) but not when a customer chooses shipping (only show the shipping details). 

I just can't find or figure out the liquid variable for the local pickup option to make it work.  I've found and tried the {% if order.pickup_in_store? %} (from here) but that doesn't work on this form; my code does not get displayed.

Any help would be greatly appreciated.

Thanks,

Matt

0 Likes
Highlighted
Tourist
5 0 1

Still looking for anyone that can help with this. 

Thanks,
Matt

0 Likes
Shopify Partner
119 19 33

This is an accepted solution.

The {% if order.pickup_in_store? %} seems to only work for notifications. There's no mention of an attribute of that name inside a pickup from store order's JSON. What you can try and see if it might work in your case, is using the shipping lines information, which the Order Printer app should be able to find. Try using the following if statement:

 

{% if shipping_lines[0].title == 'Your Local pickup location name' %}

 

Replace 'Your Local pickup location name' with the exact name you use for your store pickup option. You can find that if you go to Settings > Shipping and delivery, under Local Pickup. In this case, your extra information should only display if the order's shipping line title defaults to the local pickup option, instead of a standard shipping name.

Curious to know if that works for you. 

Panos Voulgaris
Creative director / Partner @ MALVI
Founder @ function( )
1 Like
Highlighted
Tourist
5 0 1

Thank you so much, that worked perfectly!   Greatly appreciate you taking the time to help me!

Cheers!

Matt

1 Like
Highlighted
Shopify Partner
119 19 33

Glad I could help! 

Granted, it's not best practice to call directly the position of a property name, but in this case it will always revert to 0, so you shouldn't have any issues—since no one can have something both shipped and picked up at the same time.

Take care!

Panos Voulgaris
Creative director / Partner @ MALVI
Founder @ function( )
1 Like