Shopify Order Printer App - Custom Fields

Mike_Parker
Shopify Partner
20 0 2

Can anyone tell me if it possible to include custom fields when printing out invoices / delivery notes via the Shopify Order Printer App?

For example, I allow customers to enter a gift message when buying certain products using:   

<div class="gift-message">            
            <p class="field">
              <label>Sending as a gift? - Enter a gift message below (optional).</label>
              <textarea id="event-date-special-notes" name="properties[Gift Message]"></textarea>
            </p>
          </div>

However, I can't find a way to include this message on reports printed by the 'Order Printer App'?

Any help would be appreciated, thanks.

0 Likes
Andy_Storey1
Tourist
9 0 2

hi Mike

Here's how I've done it on www.prendas.co.uk

On our checkout page we ask customers for their dimensions, as all of the garments we sell are smaller than UK/US manufacturers.  So, on the cart.liquid template we have the following:

<p class="cart-attribute__field">
<label for="height">Your Measurements</label><em>In order that you receive the correct size items, we ask you to fill in the details below. If you are confident on your size choice, just leave them blank!</em>
<input size="5" id="height" type="text" placeholder="Height (cm/ft)" name="attributes[Height]" value="{{ cart.attributes["Height"] }}" />
<input size="5" id="weight" type="text" placeholder="Weight (kg/st)" name="attributes[Weight]" value="{{ cart.attributes["Weight"] }}" />
<input size="5" id="chest" type="text" placeholder="Chest (cm/inches)" name="attributes[Chest]" value="{{ cart.attributes["Chest"] }}" />
<input size="5" id="waist" type="text" placeholder="Waist (cm/inches)" name="attributes[Waist]" value="{{ cart.attributes["Waist"] }}" />
<input size="5" id="shoesize" type="text" placeholder="Shoe Size (uk/eu)" name="attributes[Shoe Size]" value="{{ cart.attributes["Shoe Size"] }}" />
</p>

In the Order Printer App template I access those like this:

        {% for attribute in attributes %}
                <strong>{{ attribute | first }}:</strong> {{ attribute | last }}<br />
        {% endfor %}
 

I looked at your code, you might want to remove the space from the field name too.

I hope that helps!

Andy

Mike_Parker
Shopify Partner
20 0 2

Hi Andy,

Thanks for your help.

I'm not sure what code I would use in my Printer App template to pull my gift message through though?

Mike

0 Likes
Andy_Storey1
Tourist
9 0 2

hi Mike

If you change your HTML to the following:

<textarea id="event-date-special-notes" name="properties[GiftMessage]"></textarea>

You could access it via:

<p>Gift Message: {{ properties.GiftMessage }}</p>

Andy

0 Likes
Mike_Parker
Shopify Partner
20 0 2

Thanks, but unfortunatley this didn't work.

My gift message is product specific and gathered on the product page rather than on the check out page so I'm not sure if this has anything to do with it not being pulled through to the Order Printer App?

I am also having trouble displaying the {% if has_high_risks? %} message on reports created by the App.

Mike

0 Likes
Ari_Yahalom
Excursionist
51 0 6

Hi Mike,

Our app gather's the gift message and shows it in the attributes section of the orders in your Shopify dashboard.

All of the printing apps print this section and it looks great on the packaging slip.

It also allows you to print it directly from the app dashboard.

It can also send it as an e-greeting card and avoid the printing altogether.

Good luck :)

0 Likes
Kasimir
Shopify Partner
385 0 63

Hi Mike,

This is doable, do you store the gift messages to each individual "line item"/product? Do you want to show each line item gift message separately?

Kasimir

"Good design is good business"
0 Likes
Mike_Parker
Shopify Partner
20 0 2

Hi, thanks for your help.

Yes, we allow a gift message for each item so would need this showing separately.

Mike

0 Likes
Kasimir
Shopify Partner
385 0 63

Hi again Mike,

You need to access the line_item.properties inside the line_item loop, so anywhere where it starts with:

{% for line_item in line_items %}

You can add the following to display line_item properties:

{% for property in line_item.properties %}
  {{ property.first }}: {{ property.last }}
{% endfor %}

This will then display all the line item properties for that line item. To go more advanced if you only just want to show the gift message, and if it exists you could do something like:

{% assign giftMessage = false %}

{% for property in line_item.properties %}
  {% if property.first == 'Gift Message' %}
    {% assign giftMessage = property.last %}
  {% endif %}
{% endfor %}

and anywhere after this you can call the gift message with:

{{ giftMessage }}

Or even with a optional message to be shown before it, if the giftMessage exists:

{% if giftMessage %}
  Gift Message is: {{ giftMessage }}
{% endif %}

Hopefully this helps you get started.

Kasimir

"Good design is good business"
0 Likes
Ian_Sharrem
New Member
1 0 0

Thanks Andy, the attribute loop worked a treat to bring in information captured at the cart page.

0 Likes