Liquid File Changes
Overview
Caratwise stores internal data as line item properties prefixed with _. These should be hidden from customers, while relevant data can be displayed in a user-friendly format.
Note: File names may vary depending on your theme.
1. Hide Internal Properties
Filter out _ prefixed properties so customers don't see internal Caratwise data.
Files to Update
sections/cart-items.liquidsections/main-cart-items.liquidsnippets/cart-line-item.liquid
Default Code (Before)
{% for p in item.properties %}
{{ p.first }}: {{ p.last }}
{% endfor %}
Recommended Update (After)
{% for p in item.properties %}
{% unless p.first == blank or p.first == '' %}
{% unless p.first contains '_' %}
<div class="product-option">
<dt>{{ p.first }}:</dt>
<dd>{{ p.last }}</dd>
</div>
{% endunless %}
{% endunless %}
{% endfor %}
Sample Line Item Property Data
Wedding Band (Left):
{
"_caratwise_uuid": "xgrm5njzkf",
"_left_band_price": 920,
"_band_type": "left_band",
"_ring_image": "https://cdn.shopify.com/...",
"_ring_title": "Lab Grown Diamond Wedding Band in 14K Rose Gold",
"_b_tcw": "0.66",
"_b_fit": "Perfect Match",
"_b_engraving": "",
"_b_material": "14K Rose Gold"
}
Wedding Band (Right):
{
"_caratwise_uuid": "xgrm5njzkf",
"_right_band_price": 920,
"_band_type": "right_band",
"_ring_image": "https://cdn.shopify.com/...",
"_ring_title": "Lab Grown Diamond Wedding Band in 14K Rose Gold",
"_b_tcw": "0.66",
"_b_fit": "Perfect Match",
"_b_engraving": "",
"_b_material": "14K Rose Gold"
}
Engagement Ring:
{
"_caratwise_uuid": "xgrm5njzkf",
"_diamond_variant": "52264610038036",
"_ring_price": 1370,
"_diamond_price": 1509,
"_diamond_title": "2.01 ct. Round Lab Grown Diamond",
"_diamond_image": "https://loupe.diam.me/...",
"_ring_image": "https://cdn.shopify.com/...",
"_ring_title": "Mavis Lab Grown Diamond Engagement Ring in 14K Rose Gold",
"_d_carat": 2.01,
"_d_color": "F",
"_d_clarity": "VVS2",
"_d_cut": "EX",
"_d_shape": "Round",
"_d_cert": "IGI",
"_d_cert_url": "",
"_r_size": "5+1⁄4",
"_r_engraving": "",
"_r_tcw": "0.468",
"_r_shank": "14K Rose Gold",
"_r_head": "14K Rose Gold"
}
2. Show Custom Title in Cart
Display a friendly product name instead of the default Shopify product title.
Files to Update
sections/cart-items.liquidsections/main-cart-items.liquidsnippets/cart-line-item.liquid
Code
{% if item.properties._ring_title != blank %}
{{ item.properties._ring_title }}
{% elsif item.properties._left_band_price != blank or item.properties._band_type == 'left_band' %}
Wedding Band (Left)
{% elsif item.properties._right_band_price != blank or item.properties._band_type == 'right_band' %}
Wedding Band (Right)
{% else %}
{{ item.product.title }}
{% endif %}
3. Show Inventory Error Message
Display a stock availability message when a diamond is no longer available.

Files to Update
snippets/cart-drawer.liquidsections/main-cart-items.liquid
Code
{%- if item.properties._caratwise_uuid != blank -%}
<div id="cw-inventory-msg-{{ item.properties._caratwise_uuid }}" class="cw-error-msg"></div>
{%- endif -%}
4. Show Product Image in Cart & Mini Cart
Display the custom ring image instead of the placeholder product image.
Files to Update
snippets/cart-drawer.liquidsections/main-cart-items.liquid
Code
{%- if item.properties._ring_image != blank -%}
<img
src="{{ item.properties._ring_image | escape }}"
class="cart-item__image"
alt="{{ item.product.title | escape }}"
loading="lazy"
width="150"
height="150">
{%- elsif item.image -%}
<img
src="{{ item.image | image_url: width: 300 }}"
class="cart-item__image"
alt="{{ item.image.alt | default: item.product.title | escape }}"
loading="lazy"
width="150"
height="{{ 150 | divided_by: item.image.aspect_ratio | ceil }}">
{%- endif -%}
5. Add Edit Link in Cart
Allow customers to return to the builder and modify their customized ring.
Files to Update
snippets/cart-drawer.liquidsections/main-cart-items.liquid
Code
{%- if item.properties._caratwise_edit_url != blank -%}
<a href="{{ item.properties._caratwise_edit_url }}"
class="cw-edit-btn"
onclick="sessionStorage.setItem('cw_edit_mode','1');sessionStorage.setItem('cw_edit_old_uuid','{{ item.properties._caratwise_uuid }}')">
Edit
</a>
{%- endif -%}
6. Disable Product Link for Caratwise Items
Prevent customers from clicking through to the hidden placeholder product page.
Files to Update
snippets/cart-drawer.liquidsections/main-cart-items.liquid
Code
{%- if item.properties._caratwise_uuid -%}
<a href="javascript:void(0);" class="cart-item__name h4 break">
{{ item.product.title | escape }}
</a>
{%- endif -%}
Full Cart & Mini Cart Reference
