Shopify / Liquid - Доступ к объекту товара вне корзины - PullRequest
0 голосов
/ 14 июля 2020

Я пытаюсь использовать приведенный ниже код за пределами cart.liquid

                 <span class="quantity spacing--3">
                    <div class="input--number">
                      <input type="text" name="updates[]" id="updates_{{ item.id }}" value="{{ item.quantity }}" min="1" pattern="[1-9]*" />
                    </div>
                  </span>

Чтобы количество выглядело так, как в корзине. Я вижу в файле корзины, как он перебирает элементы в корзине, но как мне получить к нему доступ без зацикливания? Или мне все равно нужно l oop, чтобы селектор qty работал?

enter image description here

Below is my 'cart.liquid' file

 {% if customer.tags! = blank%}  {% endif%} {% if cart.item_count> 0%} {% для товара в cart.items%}  {% include «framework - image», image: item.image%}    {{item.title}}  {% assign property_size = item.properties | size%} {% if property_size> 0%} {% for p в item.properties%} {% if p.last == blank%} {{p.first}}: {% comment%} Проверить, был ли связанный загруженный файл {% endcomment%} {% if p.last contains '/ uploads /'%}  {{p.last | разделить: '/' | last}}  {% else%} {{p.last}} {% endif%} 
{% endunless%} {% endfor%} {% endif%} {{item.title}} {% assign property_size = item.properties | size%} {% if property_size> 0%} {% for p в item.properties%} {% if p.last == blank%} {{p.first}}: {% comment%} Проверить, был ли связанный загруженный файл {% endcomment%} {% if p.last contains '/ uploads /'%} {{p.last | разделить: '/' | last}} {% else%} {{p.last}} {% endif%}
{% endunless%} {% endfor%} {% endif%} {{item.price | money}} {% include 'snippet-symbol' with 'cross-circle'%} {{'cart.remove_item' | t}} {% endfor%} {{'cart.update_cart' | t}} {{'cart.subtotal' | t}} {{cart.total_price | деньги}} {% if settings.cart - show-note%} {{'cart.order_notes' | t}} {{note}} {% endif%} {{'cart.shipping_taxes_notification' | t}} {% include 'wsg-ship-partial'%} {{'cart.continue' | t}} {% if additional_checkout_buttons и customer.tags == blank%}
{{content_for_additional_checkout_buttons}} {% endif% } {% else%} {{'cart.empty_ html' | t}} {% endif%}
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...