Featured Product Quantity In Stock

I want to figure out how to add the standard (Dawn Theme) In Stock Quantity Tracker from the Product Page to a Featured Product. I was able to copy some code from the main-product.liquid to the featured-product.liquid and have it display the green circle and “In Stock” but it does not display the quantity.

Any help is appreciated!

Hi @EBONPYRE

You can do this using custom code.

{{ product.inventory }} using this variable you can get the stocks of products.

Rest you can Add HTMl accordingly

open featured-product. liquid find this line

{%- when ‘title’ -%}

{%- if product.title != blank -%}

and above it paste this :


                  
                  Remaing items in Stock: {{ product.variants.first.inventory_quantity }}
                

                

and it should help but create a backup of main file before doing it .

There may be a better way to do this, but I was able to resolve this by pasting the following in featured-product.liquid under {%- when ‘buy_buttons’ -%}

{%- if product.selected_or_first_available_variant.inventory_management == 'shopify' -%} {%- if product.selected_or_first_available_variant.inventory_quantity > 0 -%} {{ product.selected_or_first_available_variant.inventory_quantity | append: ' ' | append: 'in stock' }} {%- else -%} {%- if product.selected_or_first_available_variant.inventory_policy == 'continue' -%} {{ 'products.product.inventory_out_of_stock_continue_selling' | t }} {%- else -%} {{ 'products.product.inventory_out_of_stock' | t }} {%- endif -%} {%- endif -%} {%- endif -%}

This worked great, Thanks. But how do I get it in the same format as my other product info, where it shows stock quantity below price.?