Shopify themes, liquid, logos, and UX
Hi, I am trying to display a message on my thank you page when a metafield contains a certain value. I have the following code, but it does not seem to work.
Would anyone be able to please advise?
Many thanks.
{% if order.metafields.custom.select_delivery_status != blank %} <script>Shopify.Checkout.OrderStatus.addContentBox( '<b><h2><u>Order status</u><br>{% case order.metafields.custom.select_delivery_status | metafield %} {% when "been left in safe place" %}<p>Please see below for a proof of delivery photo.</p> {% when "to be redelivered" %}<p>A calling card has been left at the delivery address for the recipient to rearrange delivery.</p> {% when "been delivered to recipient" %}<p>Flowers were received at the delivery address.</p> {% else %}<p>Thank you for your order!<br>Your current order status is <b>unfulfilled</b> {% endcase %}</h2></b></u>' ) </script> {% endif %}
Hello @LittlePaddocks
Try this code
{% if order.metafields.custom.select_delivery_status != blank %}
<script>
{% case order.metafields.custom.select_delivery_status %}
{% when "been left in safe place" %}
Shopify.Checkout.OrderStatus.addContentBox(
'<b><h2><u>Order status</u><br><p>Please see below for a proof of delivery photo.</p></h2></b>'
);
{% when "to be redelivered" %}
Shopify.Checkout.OrderStatus.addContentBox(
'<b><h2><u>Order status</u><br><p>A calling card has been left at the delivery address for the recipient to rearrange delivery.</p></h2></b>'
);
{% when "been delivered to recipient" %}
Shopify.Checkout.OrderStatus.addContentBox(
'<b><h2><u>Order status</u><br><p>Flowers were received at the delivery address.</p></h2></b>'
);
{% else %}
Shopify.Checkout.OrderStatus.addContentBox(
'<b><h2><u>Order status</u><br><p>Thank you for your order!<br>Your current order status is <b>unfulfilled</b></p></h2></b>'
);
{% endcase %}
</script>
{% endif %}
Was my reply helpful? Click Like to let me know!
Was your question answered? Mark it as an Accepted Solution.
Hi @niraj_patel ,
Thanks for the reply. I have tried adding the code but unfortunately it is still not displaying. Is there any other things i could try?
Thanks!
Learn how to expand your operations internationally with Shopify Academy’s learning path...
By Shopify Feb 4, 2025Hey Community, happy February! Looking back to January, we kicked off the year with 8....
By JasonH Feb 3, 2025Expand into selling wholesale with Shopify Academy’s learning path, B2B on Shopify: Lau...
By Shopify Jan 28, 2025