All things Shopify and commerce
Hi,
2 questions:
-If you add something to my cart, the prices are twice visible, under the product title and then right of it again. I just want it to show compare price and new price on the right side.
-second question, how do I make the old total and new total visible on the cart page. I want customers to see what they were originally paying.
bundoshop.nl
In the first question, did you mean like in the image?
yes this looks good, but I also want the "Totaal" to show compare price! tnx!
I understand. The first request is easy. I will provide you with the code and instructions for it. If it doesn't perform well, we may need to make changes in the theme code.
For your second request, changes are needed in the theme code. Hire a developer for this. If have any questions let me know so I can clarify, and if not, and you'd like to work together please feel free to message me directly
Please add this code to your theme.liquid file, after <head> element in Online Store > Themes > Edit code
<script>
document.querySelector('.price.price--end').innerHTML = document.querySelector('.price-compare').parentElement.innerHTML;
document.querySelector('.price-compare').parentElement.innerHTML = "";
</script>
Did not work sir
I'm sorry. We can't make price changes with Javascript; Shopify prevents this. I just learned about it. We need to make changes in your theme code. If have any questions let me know so I can clarify, and if not, and you'd like to work together please feel free to message me directly.
This Is Working Code
{% assign actual_total = 0 %}
{%- for item in cart.items -%}
{% if item.product.compare_at_price > 0 %}
{% assign total_compare_price = item.product.compare_at_price | times: item.quantity %}
{% assign actual_total = actual_total | plus: total_compare_price %}
{% else %}
{% assign actual_total = actual_total | plus: item.line_price %}
{% endif %}
{% endfor %}
{% if actual_total != cart.total_price %}
<div class="totals total_savings_amount" role="status">
<h2 class="totals__total">Total Savings</h2>
<p class="totals__total-value total_savings">{{ actual_total | money_with_currency }}</p>
</div>
{% endif %}
By investing 30 minutes of your time, you can unlock the potential for increased sales,...
By Jacqui Sep 11, 2024We 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, 2024