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

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

LittlePaddocks
Excursionist
45 1 9

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
3992 795 1134

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 %}
- Custom themes, UI/UX design, ongoing maintenance & support.
- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder

PageFly-Richard
Shopify Partner
4902 1102 1779

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!


➜ Optimize your Shopify store with PageFly Page Builder (Free plan available) 


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

LittlePaddocks
Excursionist
45 1 9

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
3992 795 1134

Try this one

<script>
  {% if order.attributes %}
    Shopify.Checkout.OrderStatus.addContentBox(
	 '<p>{{ attributes ['metafields.my_fields.safe_place_photo'] }}</p>',
  
    )
  {% endif %}
</script>
- Custom themes, UI/UX design, ongoing maintenance & support.
- Drop an email   if you are looking for quick fix or any customization
- Email: guleriathakur43@gmail.com Skype: live:navrocks1
- Try GEMPAGES a great page builder
LittlePaddocks
Excursionist
45 1 9

@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