Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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?
{%- 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 %}
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 == '_' %}
@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?
@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":[]}
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>
@
The issue is with your add.js call not including all the property data.
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.
Starting a B2B store is a big undertaking that requires careful planning and execution. W...
By JasonH Sep 23, 2024By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024