I need help with a Product Template - contact form?

Solved

I need help with a Product Template - contact form?

lordlauzi1
Tourist
25 0 2

Hello I added a product Template to a few of my Product that has a contact Form so the customer can message me for further informations. The Problem is that I dont know what the product  was the request was sent for. I just get an Mail with the request and contact information. I appreciate any help, Thank you very much. I will link an example product: https://waffen-paar.at/products/magtech-9-mm-luger-fmj-8g-124grs-1000-stk?contact_posted=true#contac...

I used this code for the template:

{% comment %}
  The contents of the product.liquid template can be found in /sections/product-template.liquid
{% endcomment %}

{% section 'product-template-requires-contact' %}
{% section 'product-recommendations' %}

{% if collection %}
  <div class="text-center return-link-wrapper page-width">
    <a href="{{ collection.url }}" class="btn btn--secondary btn--has-icon-before return-link">
      {% include 'icon-arrow-left' %}
      {{ 'products.product.back_to_collection' | t: title: collection.title }}
    </a>
  </div>
{% endif %}

<script>
  // Override default values of shop.strings for each template.
  // Alternate product templates can change values of
  // add to cart button, sold out, and unavailable states here.
  theme.productStrings = {
    addToCart: {{ 'products.product.add_to_cart' | t | json }},
    soldOut: {{ 'products.product.sold_out' | t | json }},
    unavailable: {{ 'products.product.unavailable' | t | json }}
  }
</script>

{% assign current_variant = product.selected_or_first_available_variant %}

<script type="application/ld+json">
{
  "@context": "http://schema.org/",
  "@type": "Product",
  "name": {{ product.title | json }},
  "url": {{ shop.url | append: product.url | json }},
  {%- if product.featured_image -%}
    {%- assign image_size = product.featured_image.width | append: 'x' -%}
    "image": [
      {{ product.featured_image.src | img_url: image_size | prepend: "https:" | json }}
    ],
  {%- endif -%}
  "description": {{ product.description | strip_html | json }},
  {%- if current_variant.sku != blank -%}
    "sku": {{ current_variant.sku | json }},
  {%- endif -%}
  "brand": {
    "@type": "Thing",
    "name": {{ product.vendor | json }}
  },
  "offers": [
    {%- for variant in product.variants -%}
      {
        "@type" : "Offer",
        {%- if variant.sku != blank -%}
          "sku": {{ variant.sku | json }},
        {%- endif -%}
        "availability" : "http://schema.org/{% if product.available %}InStock{% else %}OutOfStock{% endif %}",
        "price" : {{ variant.price | divided_by: 100.00 | json }},
        "priceCurrency" : {{ cart.currency.iso_code | json }},
        "url" : {{ shop.url | append: variant.url | json }}
      }{% unless forloop.last %},{% endunless %}
    {%- endfor -%}
  ]
}
</script>

This is the information I get in the mail: contact.jpg

Accepted Solution (1)

Akibhusen
Shopify Partner
715 121 148

This is an accepted solution.

Hi @lordlauzi1,

 

Please add the below code of line inside your contact form. If this code will not work then you have to share your contact form code with me to check.

 

<input type="hidden" id="product-name" name="contact[Product Name]" value="{{product.title}}">

View solution in original post

Replies 4 (4)

Akibhusen
Shopify Partner
715 121 148

This is an accepted solution.

Hi @lordlauzi1,

 

Please add the below code of line inside your contact form. If this code will not work then you have to share your contact form code with me to check.

 

<input type="hidden" id="product-name" name="contact[Product Name]" value="{{product.title}}">
lordlauzi1
Tourist
25 0 2

Thank you very much it worked perfectly your are the best.

Have a great day!

Best Regards

Thomas Paar

Akibhusen
Shopify Partner
715 121 148

Welcome. Let me know if you need any other help.

clecoshop
New Member
5 0 0

Hi

 

the above mentioned code is not working on my contact form, kindly advise