Skip to content

Commit

Permalink
Adds RWS, MTO, and Coming Soon badges
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-scheele committed Jul 29, 2024
1 parent b11a965 commit a2890fb
Show file tree
Hide file tree
Showing 4 changed files with 91 additions and 7 deletions.
4 changes: 2 additions & 2 deletions assets/section-main-product.css
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,9 @@ a.product__text {
margin-bottom: 0.5rem;
}

.product .price--sold-out .price__badge-sale {
/* .product .price--sold-out .price__badge-sale {
display: none;
}
} */

@media screen and (min-width: 750px) {
.product__info-container {
Expand Down
18 changes: 18 additions & 0 deletions config/settings_schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -1265,6 +1265,24 @@
"id": "sold_out_badge_color_scheme",
"label": "t:settings_schema.badges.settings.sold_out_badge_color_scheme.label",
"default": "scheme-3"
},
{
"type": "color_scheme",
"id": "rws_badge_color_scheme",
"label": "RWS badge color scheme",
"default": "scheme-3"
},
{
"type": "color_scheme",
"id": "coming_soon_badge_color_scheme",
"label": "Coming Soon badge color scheme",
"default": "scheme-3"
},
{
"type": "color_scheme",
"id": "mto_badge_color_scheme",
"label": "MTO badge color scheme",
"default": "scheme-3"
}
]
},
Expand Down
54 changes: 52 additions & 2 deletions snippets/card-product.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,39 @@
>
{{- 'products.product.sold_out' | t -}}
</span>
{%- elsif card_product.compare_at_price > card_product.price and card_product.available -%}
{% endif %}
{%- if card_product.compare_at_price > card_product.price -%}
<span
id="NoMediaStandardBadge-{{ section_id }}-{{ card_product.id }}"
class="badge badge--bottom-left color-{{ settings.sale_badge_color_scheme }}"
>
{{- 'products.product.on_sale' | t -}}
</span>
{%- endif -%}
{%- if card_product.tags contains 'RWS' -%}
<span
id="Badge-{{ section_id }}-{{ card_product.id }}"
class="badge badge--bottom-left color-{{ settings.rws_badge_color_scheme }}"
>
RWS
</span>
{%- endif -%}
{%- if card_product.tags contains 'made-to-order' -%}
<span
id="Badge-{{ section_id }}-{{ card_product.id }}"
class="badge badge--bottom-left color-{{ settings.mto_badge_color_scheme }}"
>
MTO
</span>
{%- endif -%}
{%- if card_product.tags contains 'Badge-Coming Soon' -%}
<span
id="Badge-{{ section_id }}-{{ card_product.id }}"
class="badge badge--bottom-left color-{{ settings.coming_soon_badge_color_scheme }}"
>
Coming Soon
</span>
{%- endif -%}
</div>
</div>
</div>
Expand Down Expand Up @@ -561,14 +586,39 @@
>
{{- 'products.product.sold_out' | t -}}
</span>
{%- elsif card_product.compare_at_price > card_product.price and card_product.available -%}
{%- endif -%}
{%- if card_product.compare_at_price > card_product.price -%}
<span
id="Badge-{{ section_id }}-{{ card_product.id }}"
class="badge badge--bottom-left color-{{ settings.sale_badge_color_scheme }}"
>
{{- 'products.product.on_sale' | t -}}
</span>
{%- endif -%}
{%- if card_product.tags contains 'RWS' -%}
<span
id="Badge-{{ section_id }}-{{ card_product.id }}"
class="badge badge--bottom-left color-{{ settings.rws_badge_color_scheme }}"
>
RWS
</span>
{%- endif -%}
{%- if card_product.tags contains 'made-to-order' -%}
<span
id="Badge-{{ section_id }}-{{ card_product.id }}"
class="badge badge--bottom-left color-{{ settings.mto_badge_color_scheme }}"
>
MTO
</span>
{%- endif -%}
{%- if card_product.tags contains 'Badge-Coming Soon' -%}
<span
id="Badge-{{ section_id }}-{{ card_product.id }}"
class="badge badge--bottom-left color-{{ settings.coming_soon_badge_color_scheme }}"
>
Coming Soon
</span>
{%- endif -%}
</div>
</div>
</div>
Expand Down
22 changes: 19 additions & 3 deletions snippets/price.liquid
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,25 @@
{{ 'products.product.on_sale' | t }}
</span>

<span class="badge price__badge-sold-out color-{{ settings.sold_out_badge_color_scheme }}">
{{ 'products.product.sold_out' | t }}
</span>
{% unless product.tags contains 'Badge-Coming Soon' %}
<span class="badge price__badge-sold-out color-{{ settings.sold_out_badge_color_scheme }}">
{{ 'products.product.sold_out' | t }}
</span>
{% endunless %}

{% if product.tags contains 'RWS' %}
<span class="badge price__badge-rws color-{{ settings.rws_badge_color_scheme }}">RWS</span>
{% endif %}

{% if product.tags contains 'made-to-order' %}
<span class="badge price__badge-mto color-{{ settings.mto_badge_color_scheme }}">MTO</span>
{% endif %}

{% if product.tags contains 'Badge-Coming Soon' %}
<span class="badge price__badge-coming-soon color-{{ settings.coming_soon_badge_color_scheme }}">
Coming Soon
</span>
{% endif %}
{%- endif -%}
</div>
{% endunless %}

0 comments on commit a2890fb

Please sign in to comment.