Contact form from product page with url or product id

Shopify Partner
1 0 0

Hello guys, I'm trying to add a form to my product.liquid template because I need a form on every product page but I need that form to include the page url or product id or product title, anything that allows me to recognize where was the form sent from. I have the html form code which I found on the forum at the following URL:

However when I add the code from the above URL. I get the following error:

This file contains the following errors:

  • Line 248 — Liquid syntax error: in 'form' - Valid syntax: form 'type'[, object]

Try one more time:
1. Copy a contact form from template
2. Past this form to your product.liquid
3. Add hiden input to page id / url value, like this:
<label class='hide' for="ContactFormProduct">Product id</label>
<input class='hide' type="text" id="ContactFormProduct" name="contact[Product-id]" placeholder="{{ }}">

*or use {{ product.url }} or {{ product.title }}. You can also use them together "{{ product.title }} - {{ }}" ,add to the input placeholder.

Here you can find how to add a field to form:

Here you can find a Product variable:

Hope it helps!

Shopify subject matter expert | Founder at GenovaWebArt | Full-services shopify agency |