Hide out-of-stock products using an liquid code change on theme files

Hi all.

I don’t want so the Sold out product on the home page collection and product details page.

Hide out-of-stock products using an liquid code change on theme files

Thanks for help

Hi @ErSanjay

You can use automated collections to hide out-of-stock products from your customers. You can do this manually on the Collections page of your Shopify admin, or use an inventory management app to do it for you.

You might also want to hide products in your store’s default Catalog collection.

Highly recommend reading this document.

@Boost_commner i want to hide with code

Hi @ErSanjay , in this case, we recommend you to contact a Shopify Expert or Theme Expert as this will depend on which theme you are using.

@Boost_Commerce

I know your team was an expert. have many great engineering solutions I fixed using the liquid

{%- when 'product' -%}
                      {%- capture product_settings -%}{%- if section.settings.product_show_vendor -%}vendor,{%- endif -%}title,price{%- endcapture -%}
                   {% if product.available == true %}   
                    {% render 'card-product',
                          card_product: item,
                          media_aspect_ratio: section.settings.image_ratio,
                          show_secondary_image: section.settings.show_secondary_image,
                          show_vendor: section.settings.show_vendor,
                          show_rating: section.settings.show_rating,
                          lazy_load: lazy_load
                        %}
                    {%- endif -%}

reference https://shopify.dev/api/liquid/objects/product?shpxid=5dd36f15-E244-4670-4217-7125EA382529#product-available

Thanks @Shopify_77 for batter documentation