Refresh Cart template

Mr_Oso
New Member
3 0 0

Hello Team!!!

I added in the page cart, on each row, the name of Product collection and the unit price. I have marked both fields in red

The piece of code that performs is this:

 

<a style="color:black;">Precio: 
      {{ item.product.price | money }}
</a>
<p><a style="color:black;">Destinado a:
      {% for collection in item.product.collections %}
           <a style="color:grey;font-weight: bold;" href="{{collection.url}}">{{ collection.title }}</a>
       {% endfor %}
</a></p>

 

 

Captura1.PNG

But, when i click on - or + buttons, the information marked in red, disappears, please check the image:

 

Captura1.PNG

 I check the cart template and has this standar script. I think, that when i click on - or + buttons on quantity this script is launched. Any idea to add to this script the parameters to show product price and collection? Thanks a lot!

 

<script id="CartProductTemplate" type="text/template">
    {% raw %}
      {{#items}}
      <tr class="cart__row responsive-table__row">
        <td class="cart__cell--image text-center">
          <a href="{{ url }}" class="cart__image">
            <img src="{{ img }}" alt="{{ name }}">
          </a>
        </td>
        <td>
          <a href="{{ url }}" class="h5">
            {{ name }} 
          </a>
          {{#if variation}}
            <p>{{variation}}</p>
          {{/if}}
          {{#if sellingPlanAllocation}}
            <p>{{sellingPlanAllocation.selling_plan.name}}</p>
          {{/if}}
          {{#properties}}
            {{#each this}}
              {{#if this}}
                <p>{{@key}}: {{this}}</p>
              {{/if}}
            {{/each}}
          {{/properties}}

          <p>
            <a href="{% endraw %}{{ routes.cart_change_url }}{% raw %}?line={{ line }}&amp;quantity=0">{% endraw %}{{ 'cart.general.remove' | t }}{% raw %}</a>
          </p>
        </td>
        <td class="cart__cell--quantity">
          <label for="Updates_{{ key }}" class="cart__quantity-label medium-up--hide">
            {% endraw %}{{ 'cart.label.quantity' | t }}{% raw %}</label>
          <input type="number" name="updates[]" id="Updates_{{ key }}" value="{{ itemQty }}" min="0" data-line="{{ line }}" aria-label="{% endraw %}{{ 'cart.label.quantity' | t }}{% raw %}">
        </td>
        <td class="cart__cell--total">
          {{#if discountsApplied}}
            <span class="visually-hidden">{% endraw %}{{ 'products.product.regular_price' | t }}{% raw %}</span>
            <del class="cart__item-total">{{{originalLinePrice}}}</del>
            <span class="visually-hidden">{% endraw %}{{ 'products.product.sale_price' | t }}{% raw %}</span>
            <span class="cart__item-total">{{{linePrice}}}</span>
          {{else}}
            <span class="cart__item-total">{{{originalLinePrice}}}</span>
          {{/if}}
          {{#if discountsApplied}}
            <ul class="order-discount order-discount--cart order-discount--list order-discount--title" aria-label="{% endraw %}{{ 'customer.order.discount' | t }}{% raw %}">
              {{#each discounts}}
                <li class="order-discount__item">
                  {% endraw %}{%- include 'icon-saletag' -%}{% raw %}{{ this.discount_application.title }} (-{{{ this.formattedAmount }}})
                </li>
              {{/each}}
            </ul>
          {{/if}}
          {{#if unitPrice}}
            <span class="visually-hidden">{% endraw %}{{ 'products.product.unit_price_label' | t }}{% raw %}</span>
            <span class="product-unit-price">
              {% endraw %}
                {%- capture unit_price_separator -%}
                  <span aria-hidden="true">/</span><span class="visually-hidden">&nbsp;{{ 'general.accessibility.unit_price_separator' | t }}&nbsp;</span>
                {%- endcapture -%}
              {% raw %}

              <span>{{{ unitPrice.price }}}</span>{% endraw %}{{- unit_price_separator -}}{% raw %}{{#if unitPrice.addRefererenceValue }}{{{ unitPrice.reference_value }}}{{/if}}{{{ unitPrice.reference_unit }}}
            </span>
          {{/if}}
        </td>
      </tr>
      {{/items}}
    {% endraw %}
  </script>

 

 

0 Likes
Mr_Oso
New Member
3 0 0

Any idea?

0 Likes
Mr_Oso
New Member
3 0 0

some help?

0 Likes