Skip to content
This repository has been archived by the owner on Aug 30, 2018. It is now read-only.

Commit

Permalink
Merge pull request #362 from Shopify/prod-variant-price
Browse files Browse the repository at this point in the history
Updated product price to use selected variant
  • Loading branch information
cshold committed Mar 17, 2015
2 parents 1d52e68 + dca9f3b commit 660ec84
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 30 deletions.
8 changes: 0 additions & 8 deletions assets/timber.scss.liquid
Expand Up @@ -2170,14 +2170,6 @@ label.error {
/*============================================================================
#Product and Collection Grids
==============================================================================*/
.sold-out {

}

.on-sale {

}

.grid__image {
display: block;
margin: 0 auto ($gutter / 2);
Expand Down
5 changes: 1 addition & 4 deletions snippets/product-grid-item.liquid
Expand Up @@ -37,10 +37,7 @@
{% assign sold_out = false %}
{% endif %}

{% comment %}
Set a class for sold-out and on-sale items
{% endcomment %}
<div class="grid__item {{ grid_item_width }}{% if sold_out %} sold-out{% endif %}{% if on_sale %} on-sale{% endif %}">
<div class="grid__item {{ grid_item_width }}">

{% comment %}
Link to your product with the 'within: collection' filter for the link to be aware of the collection.
Expand Down
5 changes: 1 addition & 4 deletions templates/collection.list.liquid
Expand Up @@ -75,10 +75,7 @@
{% assign sold_out = false %}
{% endif %}

{% comment %}
Set a class for sold-out and on-sale items
{% endcomment %}
<div class="grid__item{% if sold_out %} sold-out{% endif %}{% if on_sale %} on-sale{% endif %}">
<div class="grid__item">

{% comment %}
Link to your product with the 'within: collection' filter for the link to be aware of the collection.
Expand Down
24 changes: 10 additions & 14 deletions templates/product.liquid
Expand Up @@ -14,12 +14,17 @@
<meta itemprop="url" content="{{ shop.url }}{{ product.url }}">
<meta itemprop="image" content="{{ product.featured_image.src | img_url: 'grande' }}">

{% comment %}
Get first variant, or deep linked one
{% endcomment %}
{% assign current_variant = product.selected_or_first_available_variant %}

{% include 'breadcrumb' %}

<div class="grid product-single">
<div class="grid__item large--one-half text-center">
<div class="product-single__photos" id="ProductPhoto">
{% assign featured_image = product.selected_or_first_available_variant.featured_image | default: product.featured_image %}
{% assign featured_image = current_variant.featured_image | default: product.featured_image %}
<img src="{{ featured_image | img_url: 'large' }}" alt="{{ featured_image.alt | escape }}" id="ProductPhotoImg">
</div>

Expand All @@ -46,12 +51,6 @@
<h1 itemprop="name">{{ product.title }}</h1>

<div itemprop="offers" itemscope itemtype="http://schema.org/Offer">

{% comment %}
Get first variant, or deep linked one
{% endcomment %}
{% assign variant = product.selected_or_first_available_variant %}

<meta itemprop="priceCurrency" content="{{ shop.currency }}">

<link itemprop="availability" href="http://schema.org/{% if product.available %}InStock{% else %}OutOfStock{% endif %}">
Expand Down Expand Up @@ -91,16 +90,13 @@
{% endfor %}
</select>

{% comment %}
Optionally show the 'compare at' or original price of the product.
{% endcomment %}
<span id="ProductPrice" class="h2{% if product.compare_at_price > product.price %} on-sale{% endif %}" itemprop="price">
{{ product.price | money }}
<span id="ProductPrice" class="h2" itemprop="price">
{{ current_variant.price | money }}
</span>

{% if product.compare_at_price > product.price %}
{% if product.compare_at_price_max > product.price %}
<p id="ComparePrice">
{{ 'products.product.compare_at' | t }} {{ product.compare_at_price_max | money }}
{{ 'products.product.compare_at' | t }} {{ current_variant.compare_at_price | money }}
</p>
{% endif %}

Expand Down

0 comments on commit 660ec84

Please sign in to comment.