Know which page the customer filled the contact form on

Topic summary

A store owner needs contact form submissions to include which product/page they were sent from to quote customized services. Emails currently show only message and customer details, not the originating page.

Core solution: edit the Shopify theme and add a hidden input that passes product information (e.g., product.title) from the product page into the contact form email. Steps include duplicating the theme (backup), editing product-template.liquid, and inserting the hidden input above the submit button so the product name appears in the email.

Outcome: The fix worked. Note that stores using a custom product template (e.g., after removing Add to Cart/Buy Now) must modify that specific template instead of product-template.liquid.

Extension: For non-product pages, adding a hidden field based on page_title lets the form include the page name, helping identify submissions from general pages.

Alternative tool: A third-party app (“Leave a Message”) offers per-page contact forms and includes the submission URL in a ticket system, potentially simplifying setup.

Open question: One participant asked how to include size and color in the email; no solution was provided in the thread. The discussion is largely resolved for page/product identification.

Summarized with AI on December 29. AI used: gpt-5.

Thank you your code worked for me!! Took some time for me to figure it out as someone without coding knowledge but I was able to change the contact form so that I know which page (not necessarily product) the form was submitted, by adding the following to the contact form section code:

{%- if page_title -%}

{%- endif -%}

This was based on your code and luckily I got it to work!

1 Like