hi im trying to add {{ line_item.fulfillment.tracking_number}} to display shipping tracking number and company to Order Printer plugin wich handles order viewing and printing but it just ignores it, i even made sure to use a working real fedex tracking number but it just gets ignored, does the liquid tag got obsolete?
Hey, you will probably need to add this to your code first:
{% for line_item in order.line_items %}
âŠ
{% endfor %}
Could you try and let me know if that helps? Otherwise you could maybe post the code here where you have these troubles!
<p style="float: right; text-align: right; margin: 0;">
{{ date | date: "%d/%m/%Y - %I:%M%p" }}<br />
Pedido {{ order_name }}
</p>
<div style="float: left; margin: 0 0 1.5em 0;" >
<strong style="font-size: 2em;"><img src="https://ci4.googleusercontent.com/proxy/Eznt9wVr1viWeMbLisiBO40Ng0Oym06Pvc7mI73B8jQ-IRdi95Y4If9Sgn4ACXheWrd8QZglFnriqDTfTQDJNE-qGYQnJHPdx3Z5sxZUsU3Edd4FEbN4k04AIAKrAUTfx2ujnU7-z7uVh4U9Nw=s0-d-e1-ft#https://cdn.shopify.com/s/files/1/0045/0700/9096/email_settings/Dilmun_logo_350px.jpg?2007" width="150">
</strong><br />
{{ shop.address }} #{{ shop.address2 }}<br/>
{{ shop.city }}<br/>
{{ shop.country }}, {{ shop.province_code }}<br>
{{ shop.zip | upcase }}
</div>
<hr />
<h3 style="margin: 0 0 1em 0;">Detalle de pedido</h3>
<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<thead>
<tr>
<th>Cantidad</th>
<th>ArtĂculo</th>
{% if show_line_item_taxes %}
<th>Impuestos</th>
{% endif %}
<th>Precio</th>
</tr>
</thead>
<tbody>
{% for line_item in line_items %}
<tr>
<td>{{ line_item.quantity }} x</td>
<td>{{ line_item.title }}</td>
{% if line_item.tax_lines %}
<td>
{% for tax_line in line_item.tax_lines %}
{{ tax_line.price | money }} <br/>
{% endfor %}
</td>
{% endif %}
<td>
{% if line_item.original_price != line_item.price %}
<s>{{ line_item.original_price | money }}</s>
{% endif %}
{{ line_item.price | money }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
{% if transactions.size > 1 %}
<h3 style="margin: 0 0 1em 0;">Detalle de transacciones</h3>
<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<thead>
<tr>
<th>Tipo</th>
<th>Cantidad</th>
<th>Especie</th>
<th>Estado</th>
</tr>
</thead>
<tbody>
{% for transaction in transactions %}
<tr>
<td>{{ transaction.gateway | payment_method }}</td>
<td>{{ transaction.amount | money }}</td>
<td>{{ transaction.kind }}</td>
<td>{{ transaction.status }}</td>
</tr>
{% endfor %}
</tbody>
</table>
{% endif %}
<h3 style="margin: 0 0 1em 0;">Detalle del pago</h3>
<table class="table-tabular" style="margin: 0 0 1.5em 0;">
<tr>
<td>Subtotal:</td>
<td>{{ subtotal_price | money }}</td>
</tr>
{% for discount in discounts %}
<tr>
<td>Incluye descuento "{{ discount.code }}"</td>
<td>{{ discount.savings | money }}</td>
</tr>
{% endfor %}
<tr>
<td>Impuestos:</td>
<td>{{ tax_price | money }}</td>
</tr>
{% if shipping_address %}
<tr>
<td>EnvĂo:</td>
<td>{{ shipping_price | money }}</td>
</tr>
{% endif %}
<tr>
<td><strong>Total:</strong></td>
<td><strong>{{ total_price | money }}</strong></td>
</tr>
{% if total_paid != total_price %}
<tr>
<td><strong>Total pagado:</strong></td>
<td><strong>{{ total_paid | money }}</strong></td>
</tr>
<tr>
<td><strong>Gran Total:</strong></td>
<td><strong>{{ total_price | minus: total_paid | money }}</strong></td>
</tr>
{% endif %}
</table>
{% if note %}
<h3 style="margin: 0 0 1em 0;">Nota</h3>
<p>{{ note }}</p>
{% endif %}
{% if shipping_address %}
<h3 style="margin: 0 0 1em 0;">Detalles del envĂo</h3>
<div style="margin: 0 0 1em 0; padding: 1em; border: 1px solid black;">
<table>
<tbody>
<tr>
<td style="width: 49%;">
<strong>{{ shipping_address.name | upcase }}</strong><br/>
{% if shipping_address.company %}
{{ shipping_address.company }}<br/>
{% endif %}
{{ shipping_address.street }}<br/>
{{ shipping_address.city }}, {{ shipping_address.country }}<br>
{{ shipping_address.zip | upcase }}
</td>
<td style="width: 49%;"><b>Fecha estimada de entrega: {{ fulfillment.tracking_number }}<br>
Numero de rastreo:
{% for line_item in order.line_items %}
{% if line_item.fulfillment.tracking_number %}
<a href="{{ line_item.fulfillment.tracking_url }}" target="_blank">{{
line_item.fulfillment.tracking_company }} #{{ line_item.fulfillment.tracking_number}}</a>
{% endif %}
<br>
{% endfor %}
</td>
</tr>
</tbody>
</table>
</div>
{% endif %}
<p align="center">Si tienes alguna duda, por favor envĂa un correo a <u>{{ shop.email }}</u>
<h3 align="center" style="margin: 0 0 1em 0;">Gracias por comprar en Dilmun</h3></p>
heres the code, thanks!!
y si estĂĄs seguro de que la orden en la que lo estĂĄs probando tiene un nĂșmero de tracking disponible?
hola, si de hecho incluso agregué un numero de rastreo valido que use hace unas semanas
- Verify Data exists at all
- Verify existence of data in the context your using
- Verify Conditionals
If your not getting output on something , next verify data, here confirm an order that you know has a tracking url
shopify.com/admin/api/2019-04/orders/#{order_id}/fulfillments.json
Also which specific file are you trying to add this to? See the email variables reference for notifications as I believe fulfillment variables are only allowed in some notification templates.
Verify your conditionals are even working:
{% for line_item in order.line_items %}
{% if line_item.fulfillment.tracking_number %}
**TestString** {% endif %}
<br> {% endfor %}
im trying to add this information to order template, not to be confused with email notifications, i tried the json address but it gives me a https error and the browser wont allow me any further
customers/order.liquid?
You have to add the proper order id and updated it for your store
its order template, main dash myshopify area you click on âordersâ, then on the order number, inside the order resume and preview theres a âmore actionsâ option i select âPrint with Order Printerâ and shows me a sort of printable form filled with the order info, on the right side of it says âEditâ and thats where i found the code, it cohabits with the shipping sticker (packing slip) template if that helps locating it
<td style="width: 49%;">
{% for line_item in line_items %}
{% if line_item.fulfillment.tracking_number %}
<b>Fecha estimada de entrega: {{ fulfillment.tracking_number }}<br>
<b>CompañĂa: {{ line_item.fulfillment.tracking_company }} <br>
Numero de rastreo: <a href="{{ line_item.fulfillment.tracking_url }}" target="_blank"> #{{ line_item.fulfillment.tracking_number}}</a></br>
{% endif %}
<br>
{% endfor %}
</td>
solved it, i had to change the for cycle, just removed the âorder.â and its back on rails, thanks for the support
Nice, good work we should have been tipped off earlier: âfor line_item in line_itemsâ is also used at the start of your code immediately after the
To clarify line_items is an object available in notification templates, otherwise order.line_items while accessing an order in an orders array
e.g. inside a for loop going over orders that then go over line items
So is in other areas for example:
{% for order in customer.orders %}
{% for line_item in order.line_items %}
So if your not inside an orders loop, then order.line_items isnât anything nor is line_items normally.
Hi,
is this solution still working?
I tried it in the Invoice default template of Order Printer app:
[...]
Fullf
Quantity
Item
{% if show_line_item_taxes %}
Taxes
{% endif %}
Price
{% for line_item in line_items %}
{% if line_item.fulfillment.tracking_number %}
<b>Fecha estimada de entrega: {{ fulfillment.tracking_number }}
<b>CompañĂa: {{ line_item.fulfillment.tracking_company }}
Numero de rastreo: #{{ line_item.fulfillment.tracking_number}}
{% endif %}
{{ line_item.quantity }} x
[...]
but I get âLiquid error: internalâ
Thanks
Me too! Can anyone help? Iâm just getting Internal error
Just incase it comes in useful to someone I also tried the solutions above to get the tracking number and shipping company to show in the Shopify Order Printer app but none of them worked. Below is the code that I stumbled upon that worked for me, Shopify must have changed something because itâs completely different to the code posted in older posts but it works.
{% if fulfillment_status == âfulfilledâ %}
{% for fulfillment in fulfillments %}
{{ fulfillment.tracking_company }}: {{ fulfillment.tracking_number }}
{% endfor %}
{% endif %}