DEBUT | Display Inventory Quantity On The Product Page

Hello,

I am trying to show inventory quantities on the product page. I’m using DEBUT theme.

Thanks !

1 Like

Hello There,
Please share your store URL and Password.
So that I will check and let you know the exact solution here.

Hi,

At product-template.liquid need to add shopify code something like this

{% if product.available %}
  

In Stock: {{ product.variants.first.inventory_quantity }}

{% else %}
  

Out of Stock

{% endif %}
1 Like

Hello @Edparis

  1. In your Shopify Admin go to online store > themes > actions > edit code
  2. Paste the following code sections above the price tag within the ‘main-product.liquid’ file:

Inventory: {{ product.variants.first.inventory_quantity }}

1 Like

Hi, Thanks a lot ! Where do you put it to have it in this zone :

{% render ‘sh_cfm-product-snippet’ %}

{% comment %}
The contents of the product.liquid template can be found in /sections/product-template.liquid
{% endcomment %}

{% section ‘product-template’ %}
{% section ‘product-recommendations’ %}

{% assign current_variant = product.selected_or_first_available_variant %}

{%section’slideshow-LAFIDELE’%}
{%section’featured-row-FIDELE-1’%}
{%section’featured-row-FIDELE-2’%}
{%section’Slideshow-LAFIDELE-1’%}
{%section’featured-row-FIDELE-3’%}
{%section’featured-row-FIDELE-5’%}
{%section’featured-row-FIDELE-4’%}

Thanks a lot ! I’m not sure where to put it code in my product .template. liquid I don’t have much lines :

{% render ‘sh_cfm-product-snippet’ %}

{% comment %}
The contents of the product.liquid template can be found in /sections/product-template.liquid
{% endcomment %}

{% section ‘product-template’ %}
{% section ‘product-recommendations’ %}

{% assign current_variant = product.selected_or_first_available_variant %}

{%section’slideshow-LAFIDELE’%}
{%section’featured-row-FIDELE-1’%}
{%section’featured-row-FIDELE-2’%}
{%section’Slideshow-LAFIDELE-1’%}
{%section’featured-row-FIDELE-3’%}
{%section’featured-row-FIDELE-5’%}
{%section’featured-row-FIDELE-4’%}

Hi @ZestardTech not sure if you can help for regarding my question above ?

I am curious to know how this works with variants. For some reason, following these steps mentioned above, if the Debut Theme liquid code is using a product-template.lidiud file, that must be edited. However, the steps above have things display a little funny when it comes to variants, for example:

If there is a Variant with the first Variant Listed on the Product Page with a Available Stock number of “0” the product page will display it as “0”, and that will not change even if the user looks at another variant (size, color, etc.). If the product is OUT OF STOCK for ALL Variants, than the page will display " " nothing at all.

The way you suggested coding this…

{% if product.available %}

In Stock: {{ product.variants.first.inventory_quantity }}

{% else %}

Out of Stock

{% endif %}

…commands to display the FIRST variant data only. How, would you go about having it display the quantity on hand for EACH VARIANT, while also, allowing the product previews to display QTY for ALL VARIANTS? This would be the proper way to code each website using this feature to avoid any issues with invalid data which would absolutely risk sales.