d
Topic
Michael Morales Shopify Partner maukau.com
Posts:
207
Last edited April 12, 2016

Metafields on Order Printer Invoices

Hello,

I installed Shopify FD to add metafields to capture our customers' VAT numbers (we enter it manually on their customer profile on the admin), and I am trying to display that information on the invoices. I've used this doc to help me, and I came up with the following: 

{% if customer.metafields.VAT.VAT %}
{% assign VAT = customer.metafields.VAT %}
{% assign key = 'VAT' %}
<li>VAT No: {{ VAT[key] }}</li>
{% endif %}

However, the VAT number I inserted on the customer profile is not showing up (regardless of the if statement). Attached is a screenshot of the metafield I created. 

Thanks in advance for any help you can give me:)

Maukau - Shopify Experts in Paris, France
i
Replies
Rob Shopify Employee
Posts:
61
April 12, 2016

Hello Michael!

Metafields aren't stored in the database with the customer information like other information is. You can see all the customer information available:  https://docs.shopify.com/themes/liquid/objects/customer   and metafields aren't listed.

I would store the information as Tags on the customer.  https://docs.shopify.com/manual/customers#edit-customers

Then you can see how to access them in code in this section:  https://docs.shopify.com/themes/liquid/objects/customer#customer-tags   of the guide I linked above for the customer information.

Rob Shopify Guru
Michael Morales Shopify Partner maukau.com
Posts:
207
April 13, 2016

Thanks for the reply Rob! I tried entering the information using customer tags as you said, but I'm not able to get it to show up on the Order Printer invoice. Here is the code I used:

{% for tag in customer.tags %}
<li>{{ tag }}</li>
{% endfor %}

or

{% if customer.tags contains "VAT" %}
<li>VAT</li>
{% endif %}

Is there anything wrong in the code, or are customer tags not able to show up on Order Printer invoices either?

Maukau - Shopify Experts in Paris, France
Posts:
213
April 15, 2016
g
1
upvotes

Hi Michael,

Unfortunately the Shopify employee has given you wrong information.. he's linked to the "theme" liquid documentation which is very different from the liquid that is available in the Shopify Order Printer app.

Basically, for "Customers" in Order Printer you only have access to their name and email address :( So metafields and tags are just not accessible within that app.

​I wish I had a better solution for you, but I don't know what else to suggest.

Cheers,
Bjorn

Bjorn Forsberg | FORSBERG+two | Award-winning Shopify Apps since 2011
Rob Weidner Shopify Partner filmgear.co.za
Posts:
18
April 10, 2017

Any luck on the Order Printer App being able to now do this? 

Posts:
213
April 11, 2017

Hey Rob,

Not that I am aware of.. unfortunately :(

Bjorn Forsberg | FORSBERG+two | Award-winning Shopify Apps since 2011
Raph Member
Posts:
4
3 months ago

Hi Bjorn. 

Same issue here. So what would you recommend as a way around that? Using any other plugin? Can we contribute to the Order Printer plugin to make this feature available?

 

Thanks

 

Raph

Posts:
213
3 months ago

Hey Raph,

Unfortunately not much we can do about this, and I don't know any workarounds. The Order Printer app is built and managed by Shopify, so we cannot contribute to it's development :(

Regards,
Bjorn

Bjorn Forsberg | FORSBERG+two | Award-winning Shopify Apps since 2011
Raph Member
Posts:
4
3 months ago

OK. Thanks for getting back to me anyway Bjorn. I may try this workaround: https://ecommerce.shopify.com/c/ecommerce-design/t/metafields-use-on-invoices-with-order-printer-360115

Raph

Posts:
213
2 months ago

Hey Raph,

That’s a great solution and will work well :) Thanks for sharing!

Cheers,

Bjorn

Bjorn Forsberg | FORSBERG+two | Award-winning Shopify Apps since 2011
Posts:
6
Last edited 2 months ago

Hi Raph,

That should work for products, but not for customers metafields. Those are still sadly after 2 years, still of limits.

Posts:
213
2 months ago

You could adapt what Raph suggested, to use cart attributes for the passing of the data instead. That way the info is not tied to the product, but to the order itself.

Bjorn Forsberg | FORSBERG+two | Award-winning Shopify Apps since 2011
Posts:
1
7 days ago

Hi Ralph, 

Were you able to get the work around for customer metafields tied to the order so you could add customer tags to invoices in Order Printer (using https://ecommerce.shopify.com/c/ecommerce-design/t/metafields-use-on-invoices-with-order-printer-360115)?

I would be very interested to get the details on your solution. 

Thanks!!

 

Raph Member
Posts:
4
7 days ago

Hi Ava,

I only needed product metafields, which works fine, but didn't try customers. Sorry.

Good luck.

Raph

Posts:
213
7 days ago

Hey Ava,

You could do the same thing for the customer tags. Here's the adapted code that needs to go within the cart page form:

{% if customer and customer.tags != blank %}
       <input id="customer-tags" type="hidden" name="attributes[customer-tags]" value="{{ customer.tags }}">
{% endif %}

This Shopify help guide will show the overall process of adding attributes on the cart page: https://help.shopify.com/en/themes/customization/cart/get-more-information-with-cart-attributes

You can then show the captured tags in the Order Printer template like this:

Tags: {{ attributes['customer-tags'] }}

Hope it helps,

Bjorn

Bjorn Forsberg | FORSBERG+two | Award-winning Shopify Apps since 2011