Why does only the last loop of line item show on the cart page?

Hi,

I have 3 custom line properties on product page, but on cart page only the last loop of line item shows up.

Does anyone know what would be the issue.?

Thanks

Are the properties included when viewing “/cart.js”? Can you share your liquid code?

1 Like

@drewisme

{%- assign property_size = item.properties | size -%}
                                                    {% if property_size > 0 %}
                                                       {% for p in item.properties %}
    {% assign first_character_in_key = p.first | truncate: 1, '' %}
    {% unless p.last == blank or first_character_in_key == '_' %}
      {{ p.first }}:
      {% if p.last contains '/uploads/' %}
        {{ p.last | split: '/' | last }}
      {% else %}
        {{ p.last }}
      {% endif %}
      

    {% endunless %}
  {% endfor %}
                                                    {% endif %}

Do the properties start with an underscore? If so, those are considered hidden properties that will be hidden from checkout. This line is also hiding those properties from cart.

{% unless p.last == blank or first_character_in_key == '_' %}
1 Like

@drewisme It doesn’t have an underscore. that’s the reason I am confused… do you this some js will affect this

Do you have a preview link or can you share your “/cart.js” content?

2 Likes

@drewisme preview link https://bit.ly/3G9gcbn

&

{"token":"86ac03b0008080886cf791afe60cf21a","note":null,"attributes":{},"original_total_price":64000,"total_price":64000,"total_discount":0,"total_weight":0.0,"item_count":2,"items":[{"id":35500367937694,"properties":{"Font Style":"Edwardian"},"quantity":1,"variant_id":35500367937694,"key":"35500367937694:98a18da9ce3b725109516ea5fe5342a9","title":"Hoodie with slogan - 30 \/ White","price":32000,"original_price":32000,"discounted_price":32000,"line_price":32000,"original_line_price":32000,"total_discount":0,"discounts":[],"sku":"00116\u0441-1","grams":0,"vendor":"Pyjama Party Shop","taxable":true,"product_id":5534369644702,"product_has_only_default_variant":false,"gift_card":false,"final_price":32000,"final_line_price":32000,"url":"\/products\/hoodie-with-slogan?variant=35500367937694","featured_image":{"aspect_ratio":0.78,"alt":"Hoodie with slogan","height":1667,"url":"https:\/\/cdn.shopify.com\/s\/files\/1\/0451\/7924\/0606\/products\/product-4.jpg?v=1596544977","width":1300},"image":"https:\/\/cdn.shopify.com\/s\/files\/1\/0451\/7924\/0606\/products\/product-4.jpg?v=1596544977","handle":"hoodie-with-slogan","requires_shipping":true,"product_type":"","product_title":"Hoodie with slogan","product_description":"","variant_title":"30 \/ White","variant_options":["30","White"],"options_with_values":[{"name":"Size","value":"30"},{"name":"Color","value":"White"}],"line_level_discount_allocations":[],"line_level_total_discount":0},{"id":35496758149278,"properties":{"Font Style":"Edwardian"},"quantity":1,"variant_id":35496758149278,"key":"35496758149278:fb12a536e8df0f2e54e76b3b50d5f893","title":"Belted chino trousers polo 2 - 30 \/ White","price":32000,"original_price":32000,"discounted_price":32000,"line_price":32000,"original_line_price":32000,"total_discount":0,"discounts":[],"sku":"00116\u0441-1","grams":0,"vendor":"Pyjama Party Shop","taxable":true,"product_id":5533718380702,"product_has_only_default_variant":false,"gift_card":false,"final_price":32000,"final_line_price":32000,"url":"\/products\/belted-chino-trousers-polo-2?variant=35496758149278","featured_image":{"aspect_ratio":0.78,"alt":"Belted chino trousers polo 2","height":1667,"url":"https:\/\/cdn.shopify.com\/s\/files\/1\/0451\/7924\/0606\/products\/product-7.jpg?v=1596556573","width":1300},"image":"https:\/\/cdn.shopify.com\/s\/files\/1\/0451\/7924\/0606\/products\/product-7.jpg?v=1596556573","handle":"belted-chino-trousers-polo-2","requires_shipping":true,"product_type":"","product_title":"Belted chino trousers polo 2","product_description":"","variant_title":"30 \/ White","variant_options":["30","White"],"options_with_values":[{"name":"Size","value":"30"},{"name":"Color","value":"White"}],"line_level_discount_allocations":[],"line_level_total_discount":0}],"requires_shipping":true,"currency":"INR","items_subtotal_price":64000,"cart_level_discount_applications":[]}
1 Like

Code of custom field: @drewisme


  

  

    
          

@
1 Like

The issue is with your add.js call not including all the property data.

1 Like

Any idea how to fix it @drewisme

You’re going to have to dig into the javascript code that makes this call to debug the issue.

1 Like