Why isn't the product SKU displaying in my cart?

I’ve added the code SKU: {{ item.variant.sku }} in the cart-template.liquid file but it’s only displaying “SKU:” from that line of code and not grabbing the actual sku from the product. Can somebody explain what I’m doing wrong please?

TIA

1 Like

Hello There,

Follow this:

  1. Open Section->cart-template.liquid->Place bellow code within {% for item in cart.items %} and {% endfor %} loop.

SKU: {{ item.variant.sku }}

Hello!

I am trying to do the same thing, get the product SKU to appear in the cart. We are using the Flex theme from Out of the Sandbox and I don’t see a Cart_Template.

My options are:

cart.liquid, cart__banner.liquid, or cart__main.liquid

Thanks for any help!

Solution: I used code SKU: {{ line_item.sku }} in the cart.liquid folder and that works perfect

Thanks! I just tried to add it to the cart.liquid file but it did not work. Here is all of the code in the cart.liquid file:

{% comment %}
The contents of the cart.liquid template can be found in /sections/cart-template.liquid
{% endcomment %}

{% section 'cart__banner' %} {% section 'cart__main' %}

Where would you insert the code? I tried right above the and under the cart__main line. Appreciate your help!

Is that all of the code? I have over 800 lines of code and mine worked when I put the SKU code on row 116 below this code:

{%- if gift_wrap_product.handle == line_item.product.handle -%}
{{ line_item.title }}
{%- else -%}
{{ line_item.title }}

SKU: {{ line_item.sku }}

1 Like

Yes, that’s all the code there is in that file. The cart__main.liquid file has 1100 lines of code but not finding a good spot to put it. I’ve reached out to OOTS, waiting to see if they have any insight but I think they might tell me this is an advanced customization. FIngers crossed!