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.
As 2024 wraps up, the dropshipping landscape is already shifting towards 2025's trends....
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024