<p>This line is incomplete:</p>

<pre><code>{% set order = craft.commerce
</code></pre>

CC BY-SA 4.0
2019-03-19T15:48:29.733Z
2019-03-19T15:48:29.733Z
Clive Portman
<pre><code>Internal Server Error
Unexpected token "name" of value "name" ("end of statement block" expected).
</code></pre>

<p>Getting this error on my commerce/products template.  What am I missing?</p>

<pre><code>{% extends 'shop/_layouts/main' %}
{% block main %}

{% for product in craft.commerce.products.limit(5).find() %}
    &lt;div class="row product"&gt;
        &lt;div class="two columns"&gt;
          {% include "shop/_images/product" with { class: 'u-max-full-width' } %}

        &lt;/div&gt;
        &lt;div class="ten columns"&gt;
            &lt;h5&gt;{% if product.url %}{{ product.link }}{% else %}{{ product.title }}{% endif %}&lt;/h5&gt;


            {% if product.variants|length %}
                &lt;form method="POST"&gt;
                    &lt;input type="hidden" name="action" value="commerce/cart/updateCart"&gt;
                    &lt;input type="hidden" name="redirect" value="shop/cart"&gt;
                    &lt;input type="hidden" name="qty" value="1"&gt;
                    {{ getCsrfInput() }}

                    &lt;select name="purchasableId" class="purchasableId"&gt;
                        {%- for purchasable in product.variants -%}
                            &lt;option {% if purchasable.stock &lt;= 0 and purchasable.unlimitedStock == false %}disabled {% endif %}
                                    data-info="product-{{ product.id }}-purchasable-{{ purchasable.id }}"
                                    value="{{ purchasable.purchasableId }}"&gt;
                                    {{ purchasable.description }} {{ purchasable.salePrice|commerceCurrency(cart.currency) }}
                            &lt;/option&gt;
                        {%- endfor -%}
                    &lt;/select&gt;

                    {% if product.unlimitedStock or (product.unlimitedStock == false and product.totalStock &gt; 0 ) %}
                  &lt;button type="submit"&gt;{{ "Add to cart"|t }}&lt;/button&gt;
                    {% else %}
                        {{ "Out of Stock"|t }}
                    {% endif %}
                &lt;/form&gt;

                {% if currentUser %}
                {% set order = craft.commerce
                &lt;select name="options[giftWrapped]"&gt;
                  &lt;option value="no"&gt;No gift wrap.&lt;/option&gt;
                  &lt;option value="yes"&gt;Gift wrapped.&lt;/option&gt;
                &lt;/select&gt;
          .orders.user(currentUser).hasPurchasables(product.defaultVariant).find() %}
          {% if order|length %} &lt;strong&gt;I already own this product: &lt;/strong&gt; &lt;a href="customer/order?orderNumber={{ order[0].number }}"&gt;Order #{{ order[0].shortNumber }}&lt;/a&gt;
                {% endif %}
                {% endif %}

                {%- for purchasable in product.variants -%}
                    &lt;div id="product-{{ product.id }}-purchasable-{{ purchasable.id }}" class="purchasableInfo" style="display:none;"&gt;
                        &lt;strong&gt;Regular Price: &lt;/strong&gt;&lt;strike&gt;{{ purchasable.price|commerceCurrency(cart.currency) }}&lt;/strike&gt;&lt;br&gt;
                        &lt;strong&gt;Now: &lt;/strong&gt;{{ purchasable.salePrice|commerceCurrency(cart.currency) }}&lt;br&gt;
                        {% if purchasable.salesApplied %}&lt;strong&gt;Sales Applied:&lt;/strong&gt;&lt;br&gt;{% endif %}
                        &lt;ul&gt;
                            {% for sale in purchasable.salesApplied  %}
                            &lt;li&gt;&lt;strong&gt;{{ sale.name }}&lt;/strong&gt; {{ sale.description }}&lt;/li&gt;
                            {% endfor %}
                        &lt;/ul&gt;
                    &lt;/div&gt;
                {%- endfor -%}

            {% endif %}
        &lt;/div&gt;
    &lt;/div&gt;
{% endfor %}
{% includejs %}
    $( ".purchasableId" ).change(function(e) {
        $(".purchasableInfo").hide();
        $("#"+($(this).find(":selected").data('info'))).toggle();
    });
{% endincludejs %}
{% endblock %}
</code></pre>

<plugin-craftcommerce><ecommerce>
Unexpected token "name" of value "name" ("end of statement block" expected)
# Unexpected token "name" of value "name" ("end of statement block" expected)

(Asked by: username_0 on 2019-03-19)

Internal Server Error
Unexpected token "name" of value "name" ("end of statement block" expected).

Getting this error on my commerce/products template.  What am I missing?
{% extends 'shop/_layouts/main' %}
{% block main %}

{% for product in craft.commerce.products.limit(5).find() %}
    
        
          {% include "shop/_images/product" with { class: 'u-max-full-width' } %}

        
        
            {% if product.url %}{{ product.link }}{% else %}{{ product.title }}{% endif %}


            {% if product.variants|length %}
                
                    
                    
                    
                    {{ getCsrfInput() }}

                    
                        {%- for purchasable in product.variants -%}
                            
                                    {{ purchasable.description }} {{ purchasable.salePrice|commerceCurrency(cart.currency) }}
                            
                        {%- endfor -%}
                    

                    {% if product.unlimitedStock or (product.unlimitedStock == false and product.totalStock > 0 ) %}
                  {{ "Add to cart"|t }}
                    {% else %}
                        {{ "Out of Stock"|t }}
                    {% endif %}
                

                {% if currentUser %}
                {% set order = craft.commerce
                
                  No gift wrap.
                  Gift wrapped.
                
          .orders.user(currentUser).hasPurchasables(product.defaultVariant).find() %}
          {% if order|length %} I already own this product:  Order #{{ order[0].shortNumber }}
                {% endif %}
                {% endif %}

                {%- for purchasable in product.variants -%}
                    
                        Regular Price: {{ purchasable.price|commerceCurrency(cart.currency) }}
                        Now: {{ purchasable.salePrice|commerceCurrency(cart.currency) }}
                        {% if purchasable.salesApplied %}Sales Applied:{% endif %}
                        
                            {% for sale in purchasable.salesApplied  %}
                            {{ sale.name }} {{ sale.description }}
                            {% endfor %}
                        
                    
                {%- endfor -%}

            {% endif %}
        
    
{% endfor %}
{% includejs %}
    $( ".purchasableId" ).change(function(e) {
        $(".purchasableInfo").hide();
        $("#"+($(this).find(":selected").data('info'))).toggle();
    });
{% endincludejs %}
{% endblock %}

**Tags:** plugin-craftcommerce, ecommerce


---

## 1 answers

### Answer by username_1 on 2019-03-19. Score: 1

This line is incomplete:
{% set order = craft.commerce


---

