Why does only the last line item property appear on the Shopify cart page?

Anthony_David_
Shopify Partner
417 46 105

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


Theme customization | Design | Shopify App Consultant
Have Any Questions? Whatsapp +1 (341) 241-4263
Based in United States
Replies 10 (10)

drewisme
Shopify Partner
13 2 19

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

Anthony_David_
Shopify Partner
417 46 105

@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/' %}
        <a class="lightbox" href="{{ p.last }}">{{ p.last | split: '/' | last }}</a>
      {% else %}
        {{ p.last }}
      {% endif %}
      <br>
    {% endunless %}
  {% endfor %}
                                                    {% endif %}
Theme customization | Design | Shopify App Consultant
Have Any Questions? Whatsapp +1 (341) 241-4263
Based in United States
drewisme
Shopify Partner
13 2 19

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 == '_' %}
Anthony_David_
Shopify Partner
417 46 105

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

Theme customization | Design | Shopify App Consultant
Have Any Questions? Whatsapp +1 (341) 241-4263
Based in United States
drewisme
Shopify Partner
13 2 19

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

Anthony_David_
Shopify Partner
417 46 105

@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":[]}

 

Theme customization | Design | Shopify App Consultant
Have Any Questions? Whatsapp +1 (341) 241-4263
Based in United States
Anthony_David_
Shopify Partner
417 46 105

Code of custom field: @drewisme 

<p class="line-item-property__field">
  <label>WOULD YOU LIKE TO CUSTOMIZE THIS PRODUCT?</label><br>
  <select id="would-you-like-to-customize-this-product" class="required"  name="properties[WOULD YOU LIKE TO CUSTOMIZE THIS PRODUCT?]">
    <option value="Yes">Yes</option>
    <option value="No">No</option>
  </select>
</p>
    
          
<fieldset class="question">
  
    <p class="line-item-property__field">
      <label for="enter-text-here">ENTER TEXT HERE</label>
      <input  class="required" id="title" type="text" name="properties[Title]" required>
    </p>

  
    <p class="line-item-property__field">
      <label>PLEASE SELECT THE FONT</label><br>
        <select  class="required" id="font-style"   name="properties[Font Style]" required>
          <option value="Edwardian">Edwardian</option>
          <option value="Jenna Sue">Jenna Sue</option>
          <option value="Apple Chancery">Apple Chancery</option>
          <option value="Angsana New">Angsana New</option>
        </select>
    </p>		


    <p class="line-item-property__field">
      <label>WHERE WOULD YOU LIKE THIS TEXT TO BE ?</label><br>
  <input required class="required" type="radio" name="properties[WHERE WOULD YOU LIKE THIS TEXT TO BE ?]" value="Front Pocket – Rs.150/-"> <span>Front Pocket – Rs.150/-</span><br>
  <input required class="required" type="radio" name="properties[WHERE WOULD YOU LIKE THIS TEXT TO BE ?]" value="Across Back – Rs. 250/-"> <span>Across Back – Rs. 250/-</span><br>

    </p>

 @ 

Theme customization | Design | Shopify App Consultant
Have Any Questions? Whatsapp +1 (341) 241-4263
Based in United States
drewisme
Shopify Partner
13 2 19

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

Screen Shot 2021-10-21 at 12.57.30 PM.png

Anthony_David_
Shopify Partner
417 46 105

Any idea how to fix it @drewisme 

Theme customization | Design | Shopify App Consultant
Have Any Questions? Whatsapp +1 (341) 241-4263
Based in United States
drewisme
Shopify Partner
13 2 19

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