How to integrate 2 jotforms on shopify

  • bighornmeats
    Asked on January 21, 2015 at 9:03 PM

    I created a form using one of your contract templates in Jotforms and added it to 2 of my products in my shopify store.  I have to repeat this process a couple more times but am confused how to adjust the cart.liquid html.  This is the procedure I followed for the first one.  Add JotForm to Shopify

  • Ashwin JotForm Support
    Replied on January 21, 2015 at 11:16 PM

    Hello bighornmeats,

    I did check the guide and I do not think that you have to do any further adjustment in the "cart.liquid" html. You have already edited the html as explained in guide correct?

    For your form to work as expected, you need to ensure that you add special tag to custom product in shopify and then thank you setting of your JotForm needs to be updated as per the guide.

    Please try to steps mentioned in the guide and you should not have any trouble. Please be noted that cart.liquid template just needs to be edited once and not for every JotForm you embed.

    Hope this helps.

    Do get back to us if you have any questions.

    Thank you!

  • bighornmeats
    Replied on January 22, 2015 at 10:48 AM

    If I use the tag "custom" for the 1st contract I created (which is working properly already) and then tag the 2nd contract I created with "custom2"  how do I implement the 2nd contract? 

  • Charlie
    Replied on January 22, 2015 at 1:05 PM

    Hi,

    Based from this guide, I believe you'll just need to create another snippet for custom2, just follow the same steps starting from step 2. You'll need to get the default embed code of the form and add it to the snippet with a tag name custom2, then proceed up until the last step.

    I hope that helps. Let us know if that works.

    Thank you.

  • bighornmeats
    Replied on January 22, 2015 at 2:36 PM
    I followed your instructions and now there is a contract showing up now but it is the first contract I created labeled "custom".  My "custom2" contract is suppose to show up there instead. 

    Maybe I messed this part up for the 2nd contract labeled "custom2". 

    Edit your cart.liquid template

    Go to your Edit HTML/CSS page, and click on cart.liquid under Templates to open this file in the online code editor.

    At the top of the file, add this code:

    {% assign needs_form = false %}
    I did not do this since it was already there from the previous contract labeled "custom"

    Then locate this code:

    {% for item in cart.items %}
    {% assign needs_form = false %}

    On the next line (after the above code), add this code:

    {% if item.product.tags contains "custom" %} {% assign needs_form = true %} {% endif %}
    This code is already there as well but I assumed I needed to add another one labeled "custom2" which I added below this one.

    Then, locate the code for your checkout button. The code will look like this:

    <input type="submit" id="getout" name="checkout" value="PROCEED TO CHECKOUT" />

    Replace the above code with this:

    I replaced the above code with the same thing listed below except I replaced "custom" with "custom2".  The below code is also listed as follows from the first contract I created. 

    {% if needs_form %} {% include 'custom' %} {% else %} <input type="submit" id="getout" name="checkout" value="PROCEED TO CHECKOUT" /> {% endif %}

    Click Save.

     

    THIS IS WHAT I HAVE FOR MY CART.LIQUID

    {% assign needs_form = false %}

    <div id="col-main" class="full content">

      <div id="page-header">
        <h2 id="page-title">{{ 'cart.general.title' | t }}</h2>
      </div>

      {% if cart.item_count == 0 %}
      <p class="empty">{{ 'cart.general.empty' | t }} {{ 'cart.general.continue_browsing_html' | t }}</p>
        {% if settings.show_right_column %}{% assign limit = 5 %}{% else %}{% assign limit = 4 %}{% endif %}
        {% include 'featured-products' with limit %}
      {% else %}
     
      <form action="/cart" method="post" id="cartform" class="clearfix">

          <table class="items">
            <colgroup>
              <col class="checkout-image" />
              <col class="checkout-info" />
              <col class="checkout-price" />
              <col class="checkout-quantity" />
              <col class="checkout-totals" />
              <col class="checkout-delete" />
            </colgroup>
       
            <thead>
              <tr class="top-labels">
                <th class="empty">&nbsp;</th>
                <th>{{ 'cart.label.product' | t }}</th>
                <th>{{ 'cart.label.price' | t }}</th>
                <th>{{ 'cart.label.quantity' | t }}</th>
                <th>{{ 'cart.label.total' | t }}</th>
                <th class="empty">&nbsp;</th>
              </tr>
            </thead>

            <tbody>
              {% for item in cart.items %}
              {% if item.product.tags contains "custom" %}
    {% assign needs_form = true %}
    {% endif %}
    {% if item.product.tags contains "custom2" %}
    {% assign needs_form = true %}
    {% endif %}

              <tr class="item {{ item.product.handle }}">
                <td>
                  <a href="{{ item.url }}">
                    <img src="{{ item | img_url: 'thumb' }}"  alt="{{ item.product.title }}0" />
                  </a>
                </td>
                <td>
                  <a href="{{ item.url }}">{{ item.title }}</a>
                  {% for p in item.properties %}
                    {% unless p.last == blank %}
                      {{ p.first }}:
                      {% if p.last contains '/uploads/' %}
                      <a href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
                      {% else %}
                      {{ p.last }}
                      {% endif %}
                      <br />
                    {% endunless %}
                  {% endfor %}
                </td>
                <td>{{ item.price | money }}</td>
                <td> <input class="text quantity" type="text" size="4" id="updates_{{ item.id }}" name="updates[]" value="{{ item.quantity }}" class="replace" /> </td>
                <td>{{ item.line_price | money }}</td>
                <td><a class="btn remove-from-cart" href="/cart/change?line={{ forloop.index }}&quantity=0">{{ 'cart.general.remove' | t }}</a></td>
              </tr>
              {% endfor %}
            </tbody>       
            <tfoot>
              <tr class="bottom-summary">
                <td colspan="3"></td>
                <td class="update-quantities"><input type="submit" id="update-cart" class="btn" name="update" value="{{ 'cart.general.update' | t }}" /></td>
                <td class="subtotal">{{ cart.total_price | money }}</td>
                <td>&nbsp;</td>
              </tr>
            </tfoot>
          </table>

          {% if settings.allow_note %}
          <div id="checkout-addnote">
            <label for="note"><a href="#" id="toggle-note">{{ 'cart.general.note_html' | t }}</a></label>
            <textarea id="note" name="note" class="hide">{{ cart.note }}</textarea>
          </div>
          {% endif %}

          <div id="checkout-proceed">
    {% if needs_form %}
    {% include 'custom' %}
    {% else %}
    {% if needs_form %}
    {% include 'custom2' %}
    {% else %}
    <input type="submit" id="getout" name="checkout" value="PROCEED TO CHECKOUT" />
    {% endif %}

    {% endif %}

            {% if additional_checkout_buttons %}       
            <div id="additional-checkout-buttons">
              <span id="additional-checkout-buttons-label">{{ 'cart.general.additional_checkouts' | t }}</span>
             {{ content_for_additional_checkout_buttons }}
            </div>
            {% endif %}                      
          </div>
          
        </form>
      {% endif %}
    </div><!--/#col-main -->

     

  • Carina
    Replied on January 22, 2015 at 4:41 PM

    I believe the problem is here:

       {% for item in cart.items %}
              {% if item.product.tags contains "custom" %}
    {% assign needs_form = true %}
    {% endif %}
    {% if item.product.tags contains "custom2" %}
    {% assign needs_form = true %}
    {% endif %}

    The endif command is used to terminate a multiple line if command. You can see here more details on this matter.Try adding {% else %} instead:

       {% for item in cart.items %}
              {% if item.product.tags contains "custom" %}
    {% assign needs_form = true %}
    {% else %}
    {% if item.product.tags contains "custom2" %}
    {% assign needs_form = true %}
    {% endif %}

     Let us know if the problem persists.

  • bighornmeats
    Replied on January 22, 2015 at 5:03 PM

    Tried it but now have an error.  Line 72 has been highlighted.

    This file contains the following errors:

    Line 72 — Liquid syntax error: Unknown tag 'endfor'

     

    {% assign needs_form = false %}

    <div id="col-main" class="full content">

      <div id="page-header">
        <h2 id="page-title">{{ 'cart.general.title' | t }}</h2>
      </div>

      {% if cart.item_count == 0 %}
      <p class="empty">{{ 'cart.general.empty' | t }} {{ 'cart.general.continue_browsing_html' | t }}</p>
        {% if settings.show_right_column %}{% assign limit = 5 %}{% else %}{% assign limit = 4 %}{% endif %}
        {% include 'featured-products' with limit %}
      {% else %}
     
      <form action="/cart" method="post" id="cartform" class="clearfix">

          <table class="items">
            <colgroup>
              <col class="checkout-image" />
              <col class="checkout-info" />
              <col class="checkout-price" />
              <col class="checkout-quantity" />
              <col class="checkout-totals" />
              <col class="checkout-delete" />
            </colgroup>
       
            <thead>
              <tr class="top-labels">
                <th class="empty">&nbsp;</th>
                <th>{{ 'cart.label.product' | t }}</th>
                <th>{{ 'cart.label.price' | t }}</th>
                <th>{{ 'cart.label.quantity' | t }}</th>
                <th>{{ 'cart.label.total' | t }}</th>
                <th class="empty">&nbsp;</th>
              </tr>
            </thead>

            <tbody>
              {% for item in cart.items %}
              {% if item.product.tags contains "custom" %}
    {% assign needs_form = true %}
    {% endif %}
    {% if item.product.tags contains "custom2" %}
    {% assign needs_form = true %}
    {% endif %}

              <tr class="item {{ item.product.handle }}">
                <td>
                  <a target="_blank" href="{{ item.url }}">
                    <img src="{{ item | img_url: 'thumb' }}"  alt="{{ item.product.title }}0" />
                  </a>
                </td>
                <td>
                  <a target="_blank" href="{{ item.url }}">{{ item.title }}</a>
                  {% for p in item.properties %}
                    {% unless p.last == blank %}
                      {{ p.first }}:
                      {% if p.last contains '/uploads/' %}
                      <a target="_blank" href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
                      {% else %}
                      {{ p.last }}
                      {% endif %}
                      <br />
                    {% endunless %}
                  {% endfor %}
                </td>
                <td>{{ item.price | money }}</td>
                <td> <input class="text quantity" type="text" size="4" id="updates_{{ item.id }}" name="updates[]" value="{{ item.quantity }}" class="replace" /> </td>
                <td>{{ item.line_price | money }}</td>
                <td><a class="btn remove-from-cart" target="_blank" href="/cart/change?line={{ forloop.index }}&quantity=0">{{ 'cart.general.remove' | t }}</a></td>
              </tr>
              {% endfor %}
            </tbody>       
            <tfoot>
              <tr class="bottom-summary">
                <td colspan="3"></td>
                <td class="update-quantities"><input type="submit" id="update-cart" class="btn" name="update" value="{{ 'cart.general.update' | t }}" /></td>
                <td class="subtotal">{{ cart.total_price | money }}</td>
                <td>&nbsp;</td>
              </tr>
            </tfoot>
          </table>

          {% if settings.allow_note %}
          <div id="checkout-addnote">
            <label for="note"><a target="_blank" href="#" id="toggle-note">{{ 'cart.general.note_html' | t }}</a></label>
            <textarea id="note" name="note" class="hide">{{ cart.note }}</textarea>
          </div>
          {% endif %}

          <div id="checkout-proceed">
    {% if needs_form %}
    {% include 'custom' %}
    {% else %}
    {% if needs_form %}
    {% include 'custom2' %}
    {% else %}
    <input type="submit" id="getout" name="checkout" value="PROCEED TO CHECKOUT" />
    {% endif %}

    {% endif %}

            {% if additional_checkout_buttons %}       
            <div id="additional-checkout-buttons">
              <span id="additional-checkout-buttons-label">{{ 'cart.general.additional_checkouts' | t }}</span>
             {{ content_for_additional_checkout_buttons }}
            </div>
            {% endif %}                      
          </div>
          
        </form>
      {% endif %}
    </div><!--/#col-main -->

  • raul
    Replied on January 22, 2015 at 6:44 PM

    From what I see in your code it seems like you didn't change the first endif command as suggested by Carina.

    Please try to change this code:

    {% for item in cart.items %}
    {% if item.product.tags contains "custom" %}
    {% assign needs_form = true %}
    {% endif %}
    {% if item.product.tags contains "custom2" %}
    {% assign needs_form = true %}
    {% endif %}

    And use this code instead:

    {% for item in cart.items %}
    {% if item.product.tags contains "custom" %}
    {% assign needs_form = true %}
    {% else %}
    {% if item.product.tags contains "custom2" %}
    {% assign needs_form = true %}
    {% endif %}

    Let know if this helps.
    Thank you.

  • bighornmeats
    Replied on January 22, 2015 at 7:04 PM

    Yes I did use Carina's suggestion.  That is when it came up with the error I stated above.  Sorry I copied that code from a previous post so that's why it doesn't reflect the change.  When I make the change I receive an error as follows:

    This file contains the following errors:

    Line 72 — Liquid syntax error: Unknown tag 'endfor'

    I highlighted this error in the code below.  This is the code for my cart.liquid

    {% assign needs_form = false %}

    <div id="col-main" class="full content">

      <div id="page-header">
        <h2 id="page-title">{{ 'cart.general.title' | t }}</h2>
      </div>

      {% if cart.item_count == 0 %}
      <p class="empty">{{ 'cart.general.empty' | t }} {{ 'cart.general.continue_browsing_html' | t }}</p>
        {% if settings.show_right_column %}{% assign limit = 5 %}{% else %}{% assign limit = 4 %}{% endif %}
        {% include 'featured-products' with limit %}
      {% else %}
     
      <form action="/cart" method="post" id="cartform" class="clearfix">

          <table class="items">
            <colgroup>
              <col class="checkout-image" />
              <col class="checkout-info" />
              <col class="checkout-price" />
              <col class="checkout-quantity" />
              <col class="checkout-totals" />
              <col class="checkout-delete" />
            </colgroup>
       
            <thead>
              <tr class="top-labels">
                <th class="empty">&nbsp;</th>
                <th>{{ 'cart.label.product' | t }}</th>
                <th>{{ 'cart.label.price' | t }}</th>
                <th>{{ 'cart.label.quantity' | t }}</th>
                <th>{{ 'cart.label.total' | t }}</th>
                <th class="empty">&nbsp;</th>
              </tr>
            </thead>

            <tbody>
              {% for item in cart.items %}
              {% if item.product.tags contains "custom" %}
    {% assign needs_form = true %}
    {% else %}
    {% if item.product.tags contains "custom2" %}
    {% assign needs_form = true %}
    {% endif %}

              <tr class="item {{ item.product.handle }}">
                <td>
                  <a href="{{ item.url }}">
                    <img src="{{ item | img_url: 'thumb' }}"  alt="{{ item.product.title }}0" />
                  </a>
                </td>
                <td>
                  <a href="{{ item.url }}">{{ item.title }}</a>
                  {% for p in item.properties %}
                    {% unless p.last == blank %}
                      {{ p.first }}:
                      {% if p.last contains '/uploads/' %}
                      <a href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
                      {% else %}
                      {{ p.last }}
                      {% endif %}
                      <br />
                    {% endunless %}
                  {% endfor %}
                </td>
                <td>{{ item.price | money }}</td>
                <td> <input class="text quantity" type="text" size="4" id="updates_{{ item.id }}" name="updates[]" value="{{ item.quantity }}" class="replace" /> </td>
                <td>{{ item.line_price | money }}</td>
                <td><a class="btn remove-from-cart" href="/cart/change?line={{ forloop.index }}&quantity=0">{{ 'cart.general.remove' | t }}</a></td>
              </tr>
              {% endfor %}
            </tbody>       
            <tfoot>
              <tr class="bottom-summary">
                <td colspan="3"></td>
                <td class="update-quantities"><input type="submit" id="update-cart" class="btn" name="update" value="{{ 'cart.general.update' | t }}" /></td>
                <td class="subtotal">{{ cart.total_price | money }}</td>
                <td>&nbsp;</td>
              </tr>
            </tfoot>
          </table>

          {% if settings.allow_note %}
          <div id="checkout-addnote">
            <label for="note"><a href="#" id="toggle-note">{{ 'cart.general.note_html' | t }}</a></label>
            <textarea id="note" name="note" class="hide">{{ cart.note }}</textarea>
          </div>
          {% endif %}

          <div id="checkout-proceed">
    {% if needs_form %}
    {% include 'custom' %}
    {% else %}
    {% if needs_form %}
    {% include 'custom2' %}
    {% else %}
    <input type="submit" id="getout" name="checkout" value="PROCEED TO CHECKOUT" />
    {% endif %}

    {% endif %}

            {% if additional_checkout_buttons %}       
            <div id="additional-checkout-buttons">
              <span id="additional-checkout-buttons-label">{{ 'cart.general.additional_checkouts' | t }}</span>
             {{ content_for_additional_checkout_buttons }}
            </div>
            {% endif %}                      
          </div>
          
        </form>
      {% endif
      </div><!--/#col-main --> %}

  • Carina
    Replied on January 22, 2015 at 8:14 PM

    Sorry about that. I believe now it will work:

    {% if item.product.tags contains "custom" %}
    {% assign needs_form = true %}
    {% elseif item.product.tags contains "custom2" %}
    {% assign needs_form = true %}
    {% endif %}

    Let us know if the problem persists.

  • bighornmeats
    Replied on January 22, 2015 at 9:52 PM

    Sorry to be a bother but it still isn't working.  I really do appreciate all the help! 

    This is what I changed it to.  

     {% for item in cart.items %}
              {% if item.product.tags contains "custom" %}
    {% assign needs_form = true %}
    {% else %}
    {% elseif item.product.tags contains "custom2" %}
    {% assign needs_form = true %}
    {% endif %}

     

    Now I get this error:

    Liquid syntax error: Unknown tag 'elseif'

  • Ashwin JotForm Support
    Replied on January 22, 2015 at 11:13 PM

    Hello,

    It seems you have one additional {% else %} before the "elseif" condition. Please use the following code and see if that helps you:

     {% for item in cart.items %}

              {% if item.product.tags contains "custom" %}

                     {% assign needs_form = true %}

              {% elseif item.product.tags contains "custom2" %}

                     {% assign needs_form = true %}

               {% endif %}

    Do get back to us if the issue persists.

    Thank you!

  • bighornmeats
    Replied on January 22, 2015 at 11:33 PM

    No that doesn't work either. 

  • Charlie
    Replied on January 23, 2015 at 8:14 AM

    Hi,

    Could you try using this one instead.

     {% for item in cart.items %}
     {% if item.product.tags contains "custom" %}
    {% assign needs_form = true %}
    {% if item.product.tags contains "custom2" %}
    {% assign needs_form = true %}
    {% endif %}

     

    Nothing in between then, no {%else%} or {%elseif%}, so the code would say if the two conditions would be true. Let us know if that works.

    Thank you.

  • bighornmeats
    Replied on January 23, 2015 at 3:53 PM

    Another Error. 

    LINE 72:  Liquid syntax error: Unknown tag 'endfor'

  • Carina
    Replied on January 23, 2015 at 5:00 PM

    I apologize for all this process. I will run further tests and will get back to you later.

    Thank you

  • Carina
    Replied on January 23, 2015 at 9:08 PM

    I've been making tests but unfortunately I still don't have a solution. At this moment I'm not sure if it is supposed to show more than one jotform, because if a user selects 2 products with 2 different tags that would mean 2 jotforms (or more) would show before checkout, and I'm not sure if this would be practical:

    How to integrate 2 jotforms on shopify Image 1 Screenshot 20

    You mentioned that you wish to add 2 contracts to different products. Maybe we can find another workaround. Please provide us more details on this project so we can try to find a workaround that suits your needs.

    I'm sorry for not being able to find a solution until now.
    Let us know if we can be of assistance.

     

     

  • Lisa Richards
    Replied on January 23, 2015 at 10:40 PM

    Thanks for looking into this Carina.  I have approximately 30 products in my store.  Four of the products are subscription services that need contracts.  Two of the products already have the functioning contract that I created following the guide I listed above.  The remaining two products require a different contract to be signed.  This is what I am trying to implement.  If this can not be done then the only way I can think of is to email the contract to them which I am trying to avoid.   It's so nice having everything through JotForms.