Search
 
SCRIPT & CODE EXAMPLE
 

RUBY

shopify cart show total save

{% 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 }}
Comment

PREVIOUS NEXT
Code Example
Ruby :: rails get source method 
Ruby :: ruby hash transform keys 
Ruby :: rails difference in minutes between 2 datetime 
Ruby :: ruby array has element 
Ruby :: comment in ruby 
Ruby :: ruby catch all exceptions 
Ruby :: rails foreach 
Ruby :: merge two lists together ruby 
Ruby :: rails validate presence 
Ruby :: httparty SSL_connect returned=1 errno=0 state=error: certificate verify failed (unable to get local issuer certificate) (OpenSSL::SSL::SSLError) 
Ruby :: liquid add date 
Ruby :: ruby test is number 
Ruby :: ruby downcase 
Ruby :: ruby datetime parse 
Ruby :: open url in ruby 
Ruby :: ruby on rails validates presence of multiple fields 
Ruby :: remove ascii characters from string ruby 
Ruby :: ruby open file and append 
Ruby :: will_paginate gem rails 
Ruby :: how to update model rails 
Ruby :: including libraries in ruby 
Ruby :: stripe test keys 
Ruby :: force stop rails server 
Ruby :: ruby to_a 
Ruby :: symbols used in hashes 
Ruby :: rails multiple rescue 
Ruby :: rails db:drop not working 
Ruby :: ruby md5 
Ruby :: class ruby 
R :: automatically wrap r text label ggplot 
ADD CONTENT
Topic
Content
Source link
Name
7+8 =