How can I include the collection product name in the email submission from the enquiry form on a Webflow collection template product page?

Published on
September 22, 2023

To include the collection product name in the email submission from the enquiry form on a Webflow collection template product page, you'll need to utilize a bit of custom code. Here are the steps to achieve this:

  1. Open the Webflow Designer and navigate to the collection template page where the enquiry form is located.
  2. Ensure that you have added a hidden field in the form element to capture the product name. To do this, select the form and go to the "Add Field" option in the right panel. Choose the "Hidden Field" option and give it a unique name like "product_name".
  3. In the Webflow Designer, go to the Page Settings for the collection template page and click on the "Custom Code" tab.
  4. In the "Head Code" section, add the following code:
<script>  function setProductName() {    var productTitle = '{{currentItem.Name}}';    document.querySelector('input[name=product_name]').value = productTitle;  }  </script>
  1. Next, go to the "Before " section in the "Custom Code" tab and add the following code:
<script>  window.addEventListener('DOMContentLoaded', () => {    setProductName();  });</script>
  1. Save your changes and publish the site.
  2. Now, when a user submits the enquiry form on a collection template product page, the collection product name will be included in the email submission. You can set up your email integration, such as using Webflow's built-in form submission feature or integrating with third-party services like Zapier or Mailchimp, to include the value of the "product_name" field in the email content.

By implementing this step-by-step guide, you will be able to include the collection product name in the email submission from the enquiry form on a Webflow collection template product page.

Additional Questions:

  1. How do I add a hidden field to a form in Webflow?
  2. Can I customize the design of the enquiry form on a Webflow collection template product page?
  3. Are there any limitations or restrictions when using custom code in Webflow?