Sold out item to show text 'sold out' instead of price - Prestige Theme

okw
Tourist
15 0 0

Hi, on my collection/product grid page, I'm trying to modify the code so that for the product that's out of stock, it will show the text 'out of stock' instead of price.

At this time I'm stuck with the code below, and item-price line is not showing anything, just blank. Any help with correcting the code is appreciated!

 

   <div class="ProductItem__PriceList {% if show_price_on_hover %}ProductItem__PriceList--showOnHover{% endif %} Heading">
            {%- if product.available -%}
              {%- if product.compare_at_price > product.price -%}
              <span class="ProductItem__Price Price Price--highlight Text--subdued">{{ product.price | money_without_trailing_zeros }}</span>
              <span class="ProductItem__Price Price Price--compareAt Text--subdued">{{ product.compare_at_price | money_without_trailing_zeros }}</span>     
             {%- elsif product.price_varies -%}
              {%- capture formatted_min_price -%}{{ product.price_min | money_without_trailing_zeros }}{%- endcapture -%}
              {%- capture formatted_max_price -%}{{ product.price_max | money_without_trailing_zeros }}{%- endcapture -%}
              <span class="ProductItem__Price Price Text--subdued">{{ 'collection.product.from_price_html' | t: min_price: formatted_min_price, max_price: formatted_max_price }}</span>
              {%- else -%}
              <span class="ProductItem__Price Price Text--subdued">{{ product.price | money_without_trailing_zeros }}</span> 
           {%- else -%}
              <span class="ProductItem__Price Price Text--subdued">Out of Stock</span>
          {%- endif -%} 
          {%- endif -%} 
          </div>

 

0 Likes
okw
Tourist
15 0 0

nevermind, caught my mistake!

but can't seem to make this work for products with more than 1 variant

{%- elsif variant.available == false and variant.inventory_quantity == 0 -%}

any idea how to change this?

0 Likes