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!
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025