Personalized checkout and custom promotions with Shopify Scripts
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 ?
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.
Discover how to increase customer engagement on your store with articles from Shopify A...
By Jacqui Apr 23, 2025Hey Community 👋 Did you know that March 15th is National Everything You Think Is W...
By JasonH Apr 1, 2025Discover how to increase the efficiency of commerce operations with Shopify Academy's l...
By Jacqui Mar 26, 2025