Hi! I saw a couple of other threads about this but not specific to Horizon theme. Is there a correct position in the liquid file to place code to do this? Thank you!
Just put it near the line items title.
Hi Paul, Can you be more specific? In the liquid code? The information is locked on the front end. Thank you!
This is the code:
{% render ‘cart-products’ %}
{% stylesheet %}
.cart-page–empty .cart-items__wrapper {
display: flex;
flex-direction: column;
align-items: center;
margin-block-start: 0;
text-align: center;
}
.cart-page__title + .cart-page__items {
margin-block-start: var(–margin-lg);
}
{% endstylesheet %}
{% schema %}
{
“name”: “t:names.cart_products”,
“tag”: null,
“settings”: [
{
“type”: “range”,
“id”: “gap”,
“label”: “t:settings.gap”,
“min”: 8,
“max”: 36,
“step”: 4,
“unit”: “px”,
“default”: 24
},
{
“type”: “select”,
“id”: “image_ratio”,
“options”: [
{
“value”: “adapt”,
“label”: “t:options.auto”
},
{
“value”: “portrait”,
“label”: “t:options.portrait”
},
{
“value”: “square”,
“label”: “t:options.square”
}
\],
“default”: “adapt”,
“label”: “t:settings.aspect_ratio”
},
{
“type”: “checkbox”,
“id”: “dividers”,
“label”: “t:settings.dividers”,
“default”: true
},
{
“type”: “checkbox”,
“id”: “vendor”,
“label”: “t:settings.vendor”,
“default”: false
},
{
“type”: “header”,
“content”: “t:content.padding”
},
{
“type”: “range”,
“id”: “padding-block-start”,
“label”: “t:settings.top”,
“min”: 0,
“max”: 100,
“step”: 1,
“unit”: “px”,
“default”: 0
},
{
“type”: “range”,
“id”: “padding-block-end”,
“label”: “t:settings.bottom”,
“min”: 0,
“max”: 100,
“step”: 1,
“unit”: “px”,
“default”: 0
},
{
“type”: “range”,
“id”: “padding-inline-start”,
“label”: “t:settings.left”,
“min”: 0,
“max”: 100,
“step”: 1,
“unit”: “px”,
“default”: 0
},
{
“type”: “range”,
“id”: “padding-inline-end”,
“label”: “t:settings.right”,
“min”: 0,
“max”: 100,
“step”: 1,
“unit”: “px”,
“default”: 0
}
],
“presets”: [
{
“name”: “t:names.cart_items”
}
]
}
{% endschema %}
Follow the code into the snippets file names.
Etiquette, respect others time by putting in the effort with YOUR time.
DO NOT dump the entirety of files or walls of test, it’s incredibly rude to expect others to trawl through that much stuff. Especially if you don’t bother to format it for reading as a bare minimum courtesy to others time.
And a DANGEROUS habit for if you get a premium theme file sharing can get you deplatformed.
Make the effort format code/text and provide ONLY the barest minimal relevant code.
Hi @ambullseye
In the Horizon theme, cart items are rendered from:
sections/main-cart-items.liquid
Inside this file, each product line item is looped like:
{% for item in cart.items %}
Within each item, you will find the product info block—usually containing:
- product title
- variant title
- price
This is exactly where you should add the SKU.
STEP-BY-STEP Instructions
Go to - Online Store - Themes - Edit code**
sections/main-cart-items.liquid
Locate the product details section:
Search for:
product-title
or
item.product.title
You will see something like:
<p class="cart-item__title">{{ item.product.title }}</p>
Add this SKU code under the title:
{% if item.variant.sku %}
<p class="cart-item__sku">SKU: {{ item.variant.sku }}</p>
{% endif %}
Best regards,
Devcoder ![]()
Please open cart-products.liquid file in snippets, above this line of code
{% if item.product.vendor and block_settings.vendor %}
Add this code and save file.
<p>SKU: <span>{{- item.sku -}}</span></p>
Hi @ambullseye
In theme customize you can use the Custom Liquid block with this code to show the SKU on product card
SKU: {{closest.product.selected_or_first_available_variant.sku}}
Sorry to trouble you with all of that.
Worked like a charm. Thank you for being so specific and kind.
Thank you for your help! This will be perfect for other product displays in the site!
Thank you for your help! I am a completely new to liquid code!
Hi @ambullseye
Okay dear, please send me the collaborator code. I will check and update you.
