How to add a contact form to a product page?

Highlighted
Tourist
10 0 1

I'm trying to add a contact form to a product page. But how? I'm using the Mobilia theme.

0 Likes
Highlighted
Community Moderator
Community Moderator
3258 245 558

Hi Arctic, 

Nick here from Shopify. 

This is something which will require some custom editing to the coding of your store from the backend. You would need to go to Online Store > Themes > Action Required > Edit Code > product-template.liquid. The best and easiest way to go about this would be to use product tags and assign a tag, say contact-required for this particular product and add the following code in:

{% if product.tags contains 'contact-required' %}
   ... your form code ...
{% endif %}

Another way to go about it is to create a special product collection that has the name contact-required in it and check if the product belongs to that collection:

{% for coll in product.collections %}
  {% if coll.handle  contains "contact-required" %}
     ... your form code ...
     {% break %}
   {% endif %}
{% endfor %}

If adding/ editing code is something you're not sure/ comfortable with, your best might be to reach out to the theme developers directly about this. The theme was developed by Out of the Sandbox and you can reach them via their direct website here. They would know best as they wrote the code and developed the theme. 

All the best, Nick

Nick | Community Moderator @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes
Highlighted
Tourist
10 0 1

Thank you, it worked!

But the contact form was added above the product. Do you know how to put it below the product?

0 Likes
Highlighted
Shopify Expert
46 2 8

Hey Artic, probably need to shift your code down a bit in the Product.Liquid. Where did you put it in your HTML code? Make sure it's below the <div> after your product description

DeKs Tech | www.dekstech.com
1 Like
Highlighted
Shopify Expert
46 2 8

If you put it in product template liquid it should be at bottom as well

DeKs Tech | www.dekstech.com
1 Like
Highlighted
Tourist
10 0 1

Thank you.

1 Like
Highlighted
Community Moderator
Community Moderator
3258 245 558

Hey Arctic, 

DeKs Tech beat me to the punch. Hopefully, that works and don't hesitate to ask should you have any other questions about this or anything else. 

All the best, Nick

Nick | Community Moderator @ Shopify
 - Was my reply helpful? Click Like to let me know! 
 - Was your question answered? Mark it as an Accepted Solution
 - To learn more visit the Shopify Help Center or the Shopify Blog

0 Likes
Highlighted
Excursionist
11 0 1

Hi, has there been a better/easier solution to this issue by now? A new app? I want to add a contact form to a product page and be able to know from which page the inquiry came from without having the customer typing the product name/code in the form. There should be a straight forward way to do it? Thanks!

0 Likes