Have your say in Community Polls: What was/is your greatest motivation to start your own business?

2 Order Attributes but only the 1st displayed/found on order status page

2 Order Attributes but only the 1st displayed/found on order status page

ultrandre
Visitor
2 0 0

I have 2 order attributes in an order (see screenshot) and want to display a box foreach of them on the order status page.

 

On my Order Status Page i have the following script

 

{% if order.attributes.trackingcodes_post_nl %}
{% assign alltrackinglinks_post_nl = {{order.attributes.trackingcodes_post_nl}} | split: "," %}
<script>Shopify.Checkout.OrderStatus.addContentBox('<h2>POST NL Versand :</h2>{% for member in alltrackinglinks_post_nl %}<h3>Link zur Sendung: <a href="https://jouw.postnl.nl/track-and-trace/{{ member }}-{{shipping_address.country_code}}-{{ shipping_address.zip}}?language=en">Klick hier</a></h3>{% endfor %}')</script>
{% endif %}

 

{% if order.attributes.trackingcodes_dpd %}
{% assign alltrackinglinks_dpd = {{order.attributes.trackingcodes_dpd}} | split: "," %}
<script>Shopify.Checkout.OrderStatus.addContentBox('<h2>DPD Versand : </h2>{% for member in alltrackinglinks_dpd %}<h3>Link zur Sendung: <a href="https://tracking.dpd.de/status/de_DE/parcel/{{ member }}">Klick hier</a></h3>{% endfor %}')</script>
{% endif %}

 

 

The Problem

Unfortunately order.attributes.trackingcodes_dpd is not found and never displayed.
Only the 1st attribute (trackingcodes_post_nl) is loaded correctely.

What am i doing wrong ?

 

 

Bildschirmfoto 2022-04-12 um 14.14.17.png

Reply 1 (1)

ultrandre
Visitor
2 0 0

Ok i fixed it. I had an additional line break between the 2 order attributes. This seems to be a problem when accessing it via order.attributes.