Add SKU to Cart under/next to item description

Highlighted
Tourist
9 0 4

I am really new to css so forgive ... I am looking to add the sku to the cart page UNDER or next to the item description, preferably under as independant second line.

I was told to add {% for item in cart.items %} {{ item.sku }} {% endfor %} in the cart.liquid template which worked BUT the SKU then shows up in the TOTAL column under the price. Where (and what code) do I put in the code to display the sku under or next to the item description?

Any and all help appreciated! Thx!;)

0 Likes
Highlighted
Astronaut
1890 1 398

Your cart.liquid probably looks something like this:

<ul style="border:0">
{% for item in cart.items %}    
      <li style="border:0;list-style:none;padding:0">
      <div class="four columns product_row">
        {{ item.image }}
      </div> 

      <div class="six columns title_column">
        <p class="cart_price">
          {{ item.price }}
        </p>
        <p>
          {{ item.title | link_to: item.variant.image.src, item.title }}
					
					
     >>>> {{ item.sku }}					
					
					
        </p> 
        <p class="cart_description">
        </p>         
      </div>
      ...
    </li>
{% endfor %}    
</ul>

Add in the line of code indicated with arrows (>>>>).  This is the general location of where you should be adding the code.  I hope this helps.

1 Like
Highlighted
Tourist
9 0 4

YOU ARE GENIUS. Worked perfectly. Thank you!!!

For anyone needing to do this, line I added is down by bottom indicated with arrows (>>>>).

Now how do I make it part of the link?;)

{% for item in cart.items %}
      <li style="border:0;list-style:none;padding:0">
      <div class="four columns product_row">
        <a href="{{ item.url }}" title="{{ item.title | escape }}">
          <img src="{{ item | img_url: 'large' }}" alt="{{ item.title | escape }}" />
        </a>
      </div> 

      <div class="six columns title_column">
        <p class="cart_price">
          {{ item.price | money }}
        </p>
        <p>
          <a href="{{ item.url }}" title="{{ item.title | escape }}">{{ item.title }}</a>
>>>>    Order Code: {{ item.sku }}
        </p> 

 

0 Likes
Highlighted
Astronaut
1890 1 398

The link text is surrounded by the <a></a> tags.  In your case, you'll want to have:

<a href="{{ item.url }}" title="{{ item.title | escape }}">{{ item.title }} Order Code: {{ item.sku }}</a>

Or if you want the order code on the next line:

<a href="{{ item.url }}" title="{{ item.title | escape }}">{{ item.title }}<br/>Order Code: {{ item.sku }}</a>

 

1 Like
Tourist
9 0 4

TYou have so helpful thank you. Last thing I promise! Again I have tried my hand at figuring it out but no joy. I would like to line item the cisutomer varient choices in the cart. Currently they display as

Fleurette Sconce (Plug In) - Ebonized Rust
Order Code: FL-SC-ER-PL

Here, "Ebonized Rust" is the "Patina" varient.

I would to display in cart as such:

Fleurette Sconce (Plug In)
Patina: Ebonzied Rust
Order Code: FL-SC-ER-PL

I now know where to put it thanks to you buy I need to remove the dash in the product description and include the varient title and then the varient they have selected. For various products the varient title is different, so won't always be patina, could be color or size or installation or whatever, so needs to call up whatever the varient title is for that particular product.

Thank you in advance if you can shed some light!

0 Likes
Highlighted
Astronaut
1890 1 398

Replace this:

<a href="{{ item.url }}" title="{{ item.title | escape }}">{{ item.title }}</a>

... with this:

<a href="{{ item.url }}" title="{{ item.title | escape }}">{{ item.product.title }}</a>
{% if item.product.options[0] %}
<br/>{{ item.product.options[0] }}: {{ item.variant.option1 }}
{% endif %}
{% if item.product.options[1] %}
<br/>{{ item.product.options[1] }}: {{ item.variant.option2 }}
{% endif %}
{% if item.product.options[2] %}
<br/>{{ item.product.options[2] }}: {{ item.variant.option3 }}
{% endif %}

 

1 Like
Highlighted
Tourist
9 0 4

Alex, I don't know you but I love you! Thank you! Are you for hire?

0 Likes
Highlighted
Tourist
9 0 4

Oy it's always something;) Works perfectly for products with varients, but for products with no varients, returns ...

Title: Default Title

Is there a code to fix that?

 

0 Likes
Highlighted
Astronaut
1890 1 398

Try:

<a href="{{ item.url }}" title="{{ item.title | escape }}">{{ item.product.title }}</a>
{% if item.product.options[0] and item.variant.option1 != "Default Title" %}
<br/>{{ item.product.options[0] }}: {{ item.variant.option1 }}
{% endif %}
{% if item.product.options[1] and item.variant.option2 != "Default Title"  %}
<br/>{{ item.product.options[1] }}: {{ item.variant.option2 }}
{% endif %}
{% if item.product.options[2] and item.variant.option3 != "Default Title"  %}
<br/>{{ item.product.options[2] }}: {{ item.variant.option3 }}
{% endif %}

 

0 Likes
Highlighted
New Member
4 0 0

This doesn't seem to work this way anymore. Does anyone know the process now?

0 Likes