How can I display a message on my thank you page based on metafield value?

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 %}

{% 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!