Skip to content

Instantly share code, notes, and snippets.

@raulbrito
Last active August 29, 2015 14:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save raulbrito/581678194f109efbe1d4 to your computer and use it in GitHub Desktop.
Save raulbrito/581678194f109efbe1d4 to your computer and use it in GitHub Desktop.
VAT rates for Shopify - single variant
<tbody>
{% for item in cart.items %}
<tr>
<td class="image">
<div class="product_image">
<a href="{{ item.url }}">
<img src="{{ item | img_url: 'small' }}" alt="{{ item.title | escape }}" />
</a>
</div>
</td>
<td class="item">
<a href="{{ item.url }}">
<strong>{{ item.product.title }}</strong>
{% if item.product.variants.size > 1 %}
<span class="variant_title">{{ item.variant.title }}</span>
{% endif %}
</a>
</td>
<td class="qty">
<input type="text" size="4" name="updates[]" id="updates_{{ item.id }}" value="{{ item.quantity }}" onfocus="this.select();" class="tc item-quantity" />
</td>
<td class="price">{{ item.line_price | times: 1.20 | money }}</td>
<td class="remove"><a href="/cart/change?line={{ forloop.index }}&quantity=0" class="cart">{{ 'cart.general.remove' | t }}</a></td>
</tr>
{% endfor %}
<tr class="summary">
<td class="image">&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td class="price"><span class="total"><strong>{{ cart.total_price | times: 1.20 | money }}<br />Int price: {{ cart.total_price | money }}</strong></span></td>
<td>&nbsp;</td>
</tr>
</tbody>
<span class="price">
{% assign variant = product.selected_or_first_available_variant %}
{% assign price_no_vat = variant.price | money %}
{% assign price = variant.price | times: 1.20 | money %}
{% assign compare_at_price_no_vat = variant.compare_at_price | money %}
{% assign compare_at_price = variant.compare_at_price | times: 1.20 | money %}
{% if product.available %}
{% if compare_at_price > price %}
<del>{{ compare_at_price | money }}</del>
{% endif %}
{% if product.price_varies %}{{ 'collections.product_item.from_text_html' | t: price: price }}{% else %}{{ price }}{% endif %}
{% else %}
{% if product.price_varies %}{{ 'collections.product_item.from_text_html' | t: price: price }}{% else %}{{ price }}{% endif %}
{% unless settings.show_sold_out_circle %}
{{ 'products.general.sold_out_html' | t }}
{% endunless %}
{% endif %}
<br>
Intl price: {{ price_no_vat }}
</span>
<div class="purchase" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
<meta itemprop="priceCurrency" content="{{ shop.currency }}" />
{% if product.available %}
<link itemprop="availability" href="http://schema.org/InStock" />
{% else %}
<link itemprop="availability" href="http://schema.org/OutOfStock" />
{% endif %}
{% assign variant = product.selected_or_first_available_variant %}
{% assign price_no_vat = variant.price %}
{% assign price = price_no_vat | times: 1.20 %}
{% assign compare_at_price_no_vat = variant.compare_at_price %}
{% assign compare_at_price = compare_at_price_no_vat | times: 1.20 %}
<h2 class="price" id="price-preview">
<span itemprop="price">{{ price | money }}</span>{% if price < compare_at_price %} <del>{{ compare_at_price | money }}</del>{% endif %}
</h2>
<h4 class="price" id="price-preview-no-vat">Int price: {{ price_no_vat | money }}</h4>
</div>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment