Shopify themes, liquid, logos, and UX
Good evening,
I tried to ad a total saving to my cart, but it did not work.
I tried {{ total_saving}}, {{cart.compare_at_price}}, {{cart.compare_at_price}}, {{product.compare_at_price}} still did not work.
I use the Prestige Theme, maybe someone knows anything about this.
I am really thankful for anyhelp!
Sincerely Eddy.
Solved! Go to the solution
This is an accepted solution.
thanks for code but i need some think is missing on code bt not any issue you can do this please add below code
{% assign total_saving = 0 %}
{% for item in cart.items %}
{% if item.variant.compare_at_price > item.variant.price %}
{% assign saving = item.variant.compare_at_price | minus: item.variant.price | times: item.quantity %}
{% assign total_saving = saving | plus: total_saving %}
{% endif %}
{% endfor %}
You Saved: {{ total_saving }}
Sorry you are facing this issue, it would be my pleasure to help you.
Welcome to the Shopify community!😊
Thanks for your good question.
Please share your site URL,
I will check out the issue and provide you a solution here.
Hey, thank you so much for your help, but unfortunately we are creating this on a template which is offline and has on the account an active template.
Sincerely Eddy.
sorry without checking code how can i guide you?
Hey,
I have made the store online.
The link is: https://baminol.myshopify.com/products/test-produkt?variant=39820543426748
Thanks for your help! 🙂
thanks can you please share side cart code
Yes of course!
{%- capture section_settings -%}
{
"type": {{ settings.cart_type | json }},
"itemCount": {{ cart.item_count }},
"drawer": true,
"hasShippingEstimator": false
}
{%- endcapture -%}
<div id="sidebar-cart" class="Drawer Drawer--fromRight" aria-hidden="true" data-section-id="cart" data-section-type="cart" data-section-settings='{{ section_settings }}'>
<div class="Drawer__Header Drawer__Header--bordered Drawer__Container">
<span class="Drawer__Title Heading u-h4">{{ 'cart.general.title' | t }}</span>
<button class="Drawer__Close Icon-Wrapper--clickable" data-action="close-drawer" data-drawer-id="sidebar-cart" aria-label="{{ 'header.navigation.close_cart' | t }}">
{%- render 'icon' with 'close' -%}
</button>
</div>
<p style="padding:8px;background-color: #eaeaea;"><strong><span style="color: #339966;"> ✓ </span>Gute Wahl! </strong>Dein Artikel liegt im Warenkorb.</p>
<form class="Cart Drawer__Content" action="{{ routes.cart_url }}" method="POST" novalidate>
<div class="Drawer__Main" data-scrollable>
{%- if settings.cart_show_free_shipping_threshold -%}
{%- assign threshold_in_cents = settings.cart_free_shipping_threshold | times: 100 -%}
<div class="Cart__ShippingNotice Text--subdued">
<div class="Drawer__Container">
{%- if cart.total_price >= threshold_in_cents -%}
<p>{{- 'cart.general.free_shipping' | t -}}</p>
{%- else -%}
{%- capture remaining_amount -%}<span>{{ cart.total_price | minus: threshold_in_cents | abs | money_without_trailing_zeros }}</span>{%- endcapture -%}
<p>{{- 'cart.general.free_shipping_remaining_html' | t: remaining_amount: remaining_amount -}}</p>
{%- endif -%}
</div>
</div>
{%- endif -%}
{%- if cart.item_count == 0 -%}
<p class="Cart__Empty Heading u-h5">{{ 'cart.general.empty' | t }}</p>
{%- else -%}
<div class="Drawer__Container">
<input type="hidden" name="attributes[collection_mobile_items_per_row]" value="">
<input type="hidden" name="attributes[collection_desktop_items_per_row]" value="">
{% render 'cart-items' %}
</div>
{%- endif -%}
</div>
{%- unless cart.item_count == 0 -%}
<div class="Drawer__Footer" data-drawer-animated-bottom>
{%- capture shipping_and_taxes_notice -%}{{ 'cart.general.shipping_and_taxes_notice' | t }}{%- endcapture -%}
{%- if settings.cart_enable_notes or shipping_and_taxes_notices != blank -%}
{%- if settings.cart_enable_notes -%}
{%- if cart.note == blank -%}
<button type="button" class="Cart__NoteButton" data-action="toggle-cart-note">{{ 'cart.general.add_note' | t }}</button>
{%- else -%}
<button type="button" class="Cart__NoteButton" data-action="toggle-cart-note">{{ 'cart.general.edit_note' | t }}</button>
{%- endif -%}
{%- endif -%}
{%- if shipping_and_taxes_notice != blank -%}
<p class="Cart__Taxes Text--subdued">{{ shipping_and_taxes_notice }}</p>
{%- endif -%}
{%- if cart.cart_level_discount_applications != blank -%}
{%- for discount_application in cart.cart_level_discount_applications -%}
<p class="Cart__Discount">{%- render 'icon' with 'sale' -%} {{ 'cart.general.discount' | t }} ({{ discount_application.title }}): -<span>{{ discount_application.total_allocated_amount | money_without_trailing_zeros }}</span></p>
{%- endfor -%}
{%- endif -%}
{%- endif -%}
<p class="Cart__Total Heading u-h6"><strong>{{ 'cart.general.total' | t }}: <span style="color: #ff0000;">{{ cart.total_price | money_without_trailing_zeros }}</span></strong><br><strong>{{ cart.general.total }}Du sparst: <span style="color: #ff0000;">{{ cart.compare_at_price_max | money }}</span></strong></p>
<p class="Cart__Total Heading u-h6"><strong>{{ cart.general.total }}Du sparst: <span style="color: #ff0000;">€{{cart.compare_at_price_max | minus: cart.price | divided_by:100}}</span></strong></p>
<p style="text-align: center;"><strong>Kostenloser Versand nach DE</strong> 🇩🇪</p>
<button type="submit" name="checkout" class="Cart__Checkout Button Button--primary Button--full">
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path d="M10 16c0-1.104.896-2 2-2s2 .896 2 2c0 .738-.404 1.376-1 1.723v2.277h-2v-2.277c-.596-.347-1-.985-1-1.723zm11-6v14h-18v-14h3v-4c0-3.313 2.687-6 6-6s6 2.687 6 6v4h3zm-13 0h8v-4c0-2.206-1.795-4-4-4s-4 1.794-4 4v4zm11 2h-14v10h14v-10z"fill="white"/></svg>
<span>{{- 'cart.general.checkout' | t -}}</span>
</button>
<img src="https://cdn.shopify.com/s/files/1/0511/5409/2211/files/Bildschirmfoto_2020-12-20_um_22.26.51.png">
{%- if settings.cart_enable_notes -%}
<div class="Cart__OffscreenNoteContainer" aria-hidden="true">
{%- if cart.note == blank -%}
<span class="Cart__NoteButton">{{ 'cart.general.add_note' | t }}</span>
{%- else -%}
<span class="Cart__NoteButton">{{ 'cart.general.edit_note' | t }}</span>
{%- endif -%}
<div class="Form__Item">
<textarea class="Cart__Note Form__Textarea" name="note" id="cart-note" rows="3" placeholder="{{ 'cart.general.note_placeholder' | t }}" data-scrollable>{{ cart.note }}</textarea>
</div>
<button type="button" class="Button Button--primary Button--full" data-action="toggle-cart-note">{{ 'cart.general.save_note' | t }}</button>
</div>
{%- endif -%}
</div>
{%- endunless -%}
</form>
</div>
This is an accepted solution.
thanks for code but i need some think is missing on code bt not any issue you can do this please add below code
{% assign total_saving = 0 %}
{% for item in cart.items %}
{% if item.variant.compare_at_price > item.variant.price %}
{% assign saving = item.variant.compare_at_price | minus: item.variant.price | times: item.quantity %}
{% assign total_saving = saving | plus: total_saving %}
{% endif %}
{% endfor %}
You Saved: {{ total_saving }}
Thank you so much!!!
If you have any time left I would be so happy if you could take a look into my other post, about the SVG Icon.
Have a great day my friend 🙂
it's my pleasure to help us
Hey Ketan, where exactly we paste this code
Hello! did you find a solution ? Im looking for the same answer
@CStudios @NawazGabol
oh sorry for that issue can you please share store url so i will check and let you know
Dropshipping, a high-growth, $226 billion-dollar industry, remains a highly dynamic bus...
By JasonH Nov 27, 2024Hey Community! It’s time to share some appreciation and celebrate what we have accomplis...
By JasonH Nov 14, 2024In today’s interview, we sat down with @BSS-Commerce to discuss practical strategies f...
By JasonH Nov 13, 2024