Our Partner & Developer boards on the community are moving to a brand new home: the .dev community forums! While you can still access past discussions here, for all your future app and storefront building questions, head over to the new forums.

Adding Line properties to cart

Adding Line properties to cart

Vy25
Tourist
6 0 1

Hi, 

 

I am going from an older to a newer shopify them.

To add my line items to cart I had this block of code from my old theme:

 

{%- unless line_item.properties == empty -%}

<ul class="cart-item__properties list--unstyled">
{%- for property in line_item.properties -%}
{%- if property.first.first == '_' -%}{%- continue -%}{%- endif -%}

 

{%-if property.first =="Image"-%}
<img class="cart-item__property" width="100px" height="100px" src="{{property.last|downcase|replace: ' ','' }}">
{%- else -%}
<li class="cart-item__property" data-name="{{property.first | downcase | replace: ' ',''|replace: '(',''|replace: ')',''|replace: ',',''|replace:':',''}}" data-value="{{property.last|downcase|replace: ' ',''}}">{{ property.first }}: {{ property.last }}</li>
{%- endif -%}
{%- endfor -%}
</ul>
{%- endunless -%}

 

 

The new theme has this block and I am not sure how to integrate my prior code since I also retained my line-property-items on the snippet files.:

{%- assign property_size = product.properties | size -%}
{% if property_size > 0 %}
{% for p in product.properties %}
{%- assign first_character_in_key = p.first | truncate: 1, '' -%}
{% unless p.last == blank or first_character_in_key == '_' %}
<div>
{{ p.first }}:
{% if p.last contains '/uploads/' %}
<a href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>ffdgfdgfdg
{% else %}
{{ p.last }}
{% endif %}
</div>
{% endunless %}
{% endfor %}
{% endif %}

Reply 1 (1)

DelightCart
Shopify Partner
1271 84 158

@Vy25 can you please send me screen shot and site url?

Delight Cart - It's time to turn your visitors into loyal shoppers! 

Delight Loyalty - Increase repeat sales quickly and build lifelong customers loyalty.