Show inventory status on homepage featured product

Show inventory status on homepage featured product

DASCPA
Shopify Partner
74 0 16

Hi All, Is it possible to show inventory status on homepage featured product. Currently shows on the product page but needs to show on a product card on homepage for featured product section. Thank you.

 

Screenshot 2024-12-05 at 17.12.39.png

Replies 2 (2)

EcomGraduates
Shopify Partner
787 68 113

find the code  that handles your  featured product cards 
{{ product.available }} or {{ product.inventory_quantity }} 


 If this fixed your issue, likes and accepting as a solution are highly appreciated
|  Build an online presence with our custom-built Shopify Theme: EcomifyTheme
|  Check out our reviews: Trustpilot Reviews
|  We are Shopify Partners: EcomGraduates Shopify Partner



LizHoang
Shopify Partner
467 58 86

Hi @DASCPA 

 

You can follow the instruction below : 

 

 

1. Go to Shopify > Theme > Edit code 

2. Go to File card-product.liquid > paste this code : 

 

<p
                  class="product__inventory"
                  id="Inventory-{{ section.id }}"
                  role="status"
                >
                  {%- if card_product.selected_or_first_available_variant.inventory_management == 'shopify' -%}
                    {%- if card_product.selected_or_first_available_variant.inventory_quantity > 0 -%}
                      {%- if card_product.selected_or_first_available_variant.inventory_quantity
                          <= block.settings.inventory_threshold
                      -%}
                        <span class="svg-wrapper" style="color: rgb(238, 148, 65)">
                          {{- 'icon-inventory-status.svg' | inline_asset_content -}}
                        </span>
                          {{-
                            'products.product.inventory_low_stock_show_count'
                            | t: quantity: card_product.selected_or_first_available_variant.inventory_quantity
                          -}}
                      {%- else -%}
                        <span class="svg-wrapper" style="color: rgb(62, 214, 96)">
                          {{- 'icon-inventory-status.svg' | inline_asset_content -}}
                        </span>
                          {{-
                            'products.product.inventory_in_stock_show_count'
                            | t: quantity: card_product.selected_or_first_available_variant.inventory_quantity
                          -}}
                      {%- endif -%}
                    {%- else -%}
                      {%- if card_product.selected_or_first_available_variant.inventory_policy == 'continue' -%}
                        <span class="svg-wrapper" style="color: rgb(62, 214, 96)">
                          {{- 'icon-inventory-status.svg' | inline_asset_content -}}
                        </span>
                        {{- 'products.product.inventory_out_of_stock_continue_selling' | t -}}
                      {%- else -%}
                        <span class="svg-wrapper" style="color: rgb(200, 200, 200)">
                          {{- 'icon-inventory-status.svg' | inline_asset_content -}}
                        </span>
                        {{- 'products.product.inventory_out_of_stock' | t -}}
                      {%- endif -%}
                    {%- endif -%}
                  {%- endif -%}
                </p>

 

LizHoang_0-1733471302386.png

 

Here is the example : 

LizHoang_1-1733471315874.png

 

 

Please let us know if our reply is helpful by giving it a Like or marking it as a Solution!

Check our Joy Rewards & Loyalty Program