Instead of Sold Out, Iâd like to display it âUnavailableâ. Meanwhile, I still want to keep the word âSold Outâ for other products.
Hello Randy,
Yes. There is a real quick and simple way to do this. Iâve created a video showing you how to get there.
Great! But I want some products to remain as âSold Outâ.
Hello @randytheasian ,
Yes, that is possible. It requires additional modifications. Here is how youâd achieve it:
Weâll need to modify a few key areas where the sold out badge appears.
First, letâs look at the card-product.liquid snippet where sold out badges are displayed. We need to modify two instances:
{%- if card_product.available == false -%}
<span
id=âNoMediaStandardBadge-{{ section_id }}-{{ card_product.id }}â
class=âbadge badgeâbottom-left color-{{ settings.sold_out_badge_color_scheme }}â
{{- âproducts.product.sold_outâ | t -}}
and
{%- if card_product.available == false -%}
<span
id=âBadge-{{ section_id }}-{{ card_product.id }}â
class=âbadge badgeâbottom-left color-{{ settings.sold_out_badge_color_scheme }}â
{{- âproducts.product.sold_outâ | t -}}
Hereâs how it should modify these sections to handle the new condition:
{%- if card_product.available == false -%}
<span
id=âNoMediaStandardBadge-{{ section_id }}-{{ card_product.id }}â
class=âbadge badgeâbottom-left color-{{ settings.sold_out_badge_color_scheme }}â
{%- if card_product.tags contains âUnavailableâ -%}
{{- âproducts.product.unavailableâ | t -}}
{%- else -%}
{{- âproducts.product.sold_outâ | t -}}
{%- endif -%}
{%- endif -%}
Youâll also need to modify the price snippet since it shows sold out badges as well:
{{ 'products.product.sold_out' | t }}Should be updated to:
{%- if product.tags contains 'Unavailable' -%} {{ 'products.product.unavailable' | t }} {%- else -%} {{ 'products.product.sold_out' | t }} {%- endif -%}Make sure your themeâs locale files (typically in locales/en.default.json or similar) have both translations defined:
{
âproductsâ: {
âproductâ: {
âsold_outâ: âSold Outâ,
âunavailableâ: âUnavailableâ
}
}
}
