Capturing product id from hyperlink in contact form

Highlighted
New Member
1 0 0

Hi.

I would like my product page to have an enquire button - which links to the contact page. The form in the contact page - will have its topic - auto filled up with the product title - or page it came from.

Currently my idea is to make the Enquiry button a hyperlink.
 <a href="/pages/contact-us?topic={{ product.title }}"><input type="button" class="action-button" value="Enquire Here">

Problem is, i need help for the contact form to capture the product title. The current code in  page.contact.liquid looks like this :

 <div class="input-row">
        <label for="topic">{{ 'contact.form.topic' | t }}</label>
        <input type="text" class="required" id="topic" class="contact[topic]" name="contact[topic]" />
      </div>

 

Thanks in advance

0 Likes