Have your say in Community Polls: What was/is your greatest motivation to start your own business?

How can I receive product images through my contact form?

Solved

How can I receive product images through my contact form?

Elka
Shopify Partner
15 0 2

Hello

I had made a contact form in the Product details page,

When someone sends me a message I get information about the product as well like product title and reference, I want to receive the product image as well but I couldn't make it work.

 

<input class="hide" type="text" name="contact[Title]" value="{{product.title}}">
<input class="hide" type="text" name="contact[produc ref]" value="{{ product.metafields.ref_id.product_ref }}">
{% for image in product.images offset:0 limit:1 %}
<input class="hide" type="text" name="contact[image]" value="{{ image.src | img_url: 'master' }}">
{% endfor %}

 

E167AFB8-5442-4e51-BC6E-52DBF2671D5F.png

 

 

 

 

Accepted Solution (1)
Not applicable

This is an accepted solution.

Hi Elka,

 

Unfortunately Shopify sanitizes text and textarea fields and removes the HTML. One way around this is to POST the form to another server that will allow HTML tags and will send the email. 

 

Regards,

 

Sam

View solution in original post

Replies 4 (4)

Not applicable

Hi Elka,

 

The easiest solution would have been to wrap the image URL in an HTML img tag so it would show you the picture in the email. Since we cannot access the email template and the fact that text input fields are sanitized the only way to see this happen is through an app or enhancement. You should still be able to click the link and view the picture is there a particular reason you want the image displayed in the email body?

 

Regards,

 

Sam 

Elka
Shopify Partner
15 0 2

Could you please show me how to do it, I tried to add an HTML IMG tag but I didn't receive it the image in my email, the reason why I need it because it helps me to see the picture of the product with the reference, that speeds my workflow.

 

Thanks~

Elka

Not applicable

This is an accepted solution.

Hi Elka,

 

Unfortunately Shopify sanitizes text and textarea fields and removes the HTML. One way around this is to POST the form to another server that will allow HTML tags and will send the email. 

 

Regards,

 

Sam

Elka
Shopify Partner
15 0 2

I get it Than you so much~