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

Update to proper default product variant price #360

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions assets/timber.scss.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -1851,14 +1851,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
Original file line number Diff line number Diff line change
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}}">
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Coding style question: we do not include spaces in a Liquid output tag when no filters are applied intentionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should definitely have spaces. I'll fix it up.


{% 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 snippets/product-list-item.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,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
20 changes: 10 additions & 10 deletions templates/product.liquid
Original file line number Diff line number Diff line change
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 Down Expand Up @@ -47,11 +52,6 @@

<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 @@ -94,13 +94,13 @@
{% 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.price < product.compare_at_price_max %}
<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