How can I display an image metafield on the thank you page?

LittlePaddocks
Excursionist
39 1 7

Hi, I am looking to display the image from the following file metafield on the thankyou page. Is there a way of doing this please?

 

Thanks 🙂

 

order.metafields.my_fields.safe_place_photo

 

Replies 5 (5)

Guleria
Shopify Partner
3106 610 870

Try this 

{% assign safePlacePhoto = order.attributes.metafields.my_fields.safe_place_photo %}

{% if safePlacePhoto != blank %}
  <img src="{{ safePlacePhoto | img_url: 'master' }}" alt="Safe Place Photo">
{% endif %}
- If helpful then please Like and Accept Solution.
- Want to modify or custom changes or bug fix on store Hire me.
- Email: guleriathakur43@gmail.com - Skype: navrocks1 ,
- Try GEMPAGES a great page builder
-Advance Search Filter

PageFly-Richard
Shopify Partner
4338 989 1643

Hi @LittlePaddocks ,
This is Richard from PageFly - Shopify Page Builder App.

You can you html into metafield. So, you just call metafield nameBest regards,
Richard | PageFly

Please let me know if it works by giving it a Like or marking it as a solution!


PageFly - #1 Page Builder for Shopify merchants.


All features are available from Free plan. Live Chat Support is available 24/7.

LittlePaddocks
Excursionist
39 1 7

Hi @PageFly-Richard & @Guleria .

 

I have added the below code using the additional scripts section in checkout settings. But it still doesn't seem to be showing. Any advice please?

 

Thanks 🙂

 

<script>
   Shopify.Checkout.OrderStatus.addContentBox(
 {% assign safePlacePhoto = order.attributes.metafields.my_fields.safe_place_photo %}

{% if safePlacePhoto != blank %}
  <img src="{{ safePlacePhoto | img_url: 'master' }}" alt="Safe Place Photo">
{% endif %}
    )
</script>

 

Guleria
Shopify Partner
3106 610 870

Try this one

<script>
  {% if order.attributes %}
    Shopify.Checkout.OrderStatus.addContentBox(
	 '<p>{{ attributes ['metafields.my_fields.safe_place_photo'] }}</p>',
  
    )
  {% endif %}
</script>
- If helpful then please Like and Accept Solution.
- Want to modify or custom changes or bug fix on store Hire me.
- Email: guleriathakur43@gmail.com - Skype: navrocks1 ,
- Try GEMPAGES a great page builder
-Advance Search Filter
LittlePaddocks
Excursionist
39 1 7

@Guleria Thanks for the suggestion, I have added it in, and the content box is displaying but unfortunately still no image... 🙂

 

Screenshot 2024-01-09 at 14.20.16.png