Passing a line item image from product page to packing slip with liquid

Passing a line item image from product page to packing slip with liquid

atxer
Shopify Partner
16 0 7

Hello! I have an interesting project which requires me to pass a line item from a product page which takes an upload image and then saves it to Shopify's CDN. I then need to display this image in a preview on the packing slip. It's already showing on the order page. I guess I'm just looking for advice on how to reference this new code on the liquid packing slip. I've also played with it a tad bit and it sometimes displays the products set image in shopify (which is how I somehow need to change the value name for the packing slip liquid). Any help much appreciated. 

Code on the product page that enables the upload: 

<p class="line-item-property__field">
<label for="custom_photo">Photo (JPG or PNG)</label>
<input required id="custom_photo" type="file" name="properties[Photo]">
</p> 

 

Code current on the packing slip which isn't working to display this image: 

{% if line_item.image != blank %}
{{ line_item.custom_photo | img_url: '150x150' | img_tag }}
{% endif %}

 

current packing slip with code above: 

Screen Shot 2021-10-19 at 6.47.19 PM.png

 

order page preview: 

Screen Shot 2021-10-19 at 6.47.08 PM.png

Replies 2 (2)

stefen
Shopify Partner
1 0 1

@atxer any progress on this? I have a similar issue where I have a base64 string in a line_item property and it won't preview the image. Works just fine in the emails however... 🤔

Zentrifuge
Shopify Partner
11 0 1

Any progress on this?

Trying to achieve a quite similiar thing here.

And a question:
With your approach, does your custom-generated line-item image stay associated with it throughout the entire order life-cycle (or is it only shown during checkout process)?