Shopify themes, liquid, logos, and UX
Hi there,
Just wondering if someone can advise. We're using the symmetry theme and trying to get the SKU to show on the cart page.
I've added into the main.cart.liquid template the following code on line 45:
<span>SKU: {{ item.variant.sku }}</span>
This is now showing the variant SKU which we need to show, however if products are added to the cart that don't have variants then no SKU is displayed.
Can someone tell me what to edit so I can have this displayed as well?
Many thanks!
Solved! Go to the solution
This is an accepted solution.
Hi there,
Thank you for your suggestion, you helped me get to the solution myself!
I had to change it slightly, so I had to change the code to this:
<div class="variant"> SKU: {{ item.sku }}</div>
I had to move it up a few lines to drop underneath the top level products rather than having it after the variant details.
This means it still pulls through whether its a top level product or a variant.
Thank you for your help, we got there in the end!
do you want to hide the SKU: text if the variant does not have SKU?
if yes then change the line to something like this
{% unless item.variant.sku == blank %}
<span>SKU: {{ item.variant.sku }}</span>
{% endunless %}
or
{% if item.variant.sku %}
<span>SKU: {{ item.variant.sku }}</span>
{% endif %}
All of our variants have SKU's so that part is fine.
The problem I've got is when its just a standalone product with no variants then I can't get the SKU to show, if that makes sense?
Thank you for coming back to me!
is this good?
{{ item.sku }}
( i think you get line_item as the item )
change code on line 45 to this:
<span>SKU: {{ item.sku }}</span>
or
<span>SKU: {{ line_item.sku }}</span>
Hope this can help you,
If our suggestions are useful, please let us know by giving it a like or marking it as a solution. Thank you
If our suggestions are useful, please let us know by giving it a like, marking it as a solution.
BSS: B2B Wholesale Solution |BSS: B2B Portal, Quote, Net 30 | B: B2B Lock Password Protect
Need help from our expert? Kindly share your request with us via community@bsscommerce.com
This is an accepted solution.
Hi there,
Thank you for your suggestion, you helped me get to the solution myself!
I had to change it slightly, so I had to change the code to this:
<div class="variant"> SKU: {{ item.sku }}</div>
I had to move it up a few lines to drop underneath the top level products rather than having it after the variant details.
This means it still pulls through whether its a top level product or a variant.
Thank you for your help, we got there in the end!
We appreciate the diverse ways you participate in and engage with the Shopify Communi...
By JasonH Sep 9, 2024Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024