I’m trying to display the inventory quantity for each product on the collection page. I would love it to be displayed above or below the Add to Cart portion. I have gone through multiple suggestions but can’t seem to get this to work.
Topic summary
A user seeks to display inventory quantities for each product on their Shopify collection page using Dawn theme 2.3.0, ideally near the Add to Cart button.
Initial Solution:
- Multiple helpers suggest adding code to the
card-product.liquidfile in the snippets folder - Basic implementation uses
{{ product_card_product.inventory_quantity }}in Liquid templating
Enhancement Request:
- User wants to bold the inventory number and add “in stock” text alongside it
- This requires more complex conditional logic checking inventory management and quantity levels
Final Working Solution:
- Helper provides complete code replacement for
card-product.liquid - Includes conditional display based on inventory tracking (Shopify management)
- Shows formatted stock messages with quantity counts
- Handles out-of-stock scenarios and continue-selling policies
Resolution:
- After troubleshooting a translation error, the final code implementation successfully displays inventory counts on collection pages
- User confirms the solution works as intended
Hello @MJGTrading ,
Just above the atc button add this code.
{{ card_product.inventory_quantity }}
Thanks
Hi @MJGTrading
Could you please share one member account to log in to your front store?
Looking forward to hearing from you soon. Thank you!
Best,
Daisy - Avada Support Team.
Hi Guleria
Which template would I add this? Collection.json, base.css??
snippets → card-product.liquid
may be code location vary because I have version 15.1.0
Hi @MJGTrading ,
Please send me the code of card-product.liquid file, I will help you add it
{% capture wpd_discounted_prices %}{%- render ‘wcp_discount’ wcp_discount:product_card_product , wpd_is_render:‘yes’ -%}{% endcapture %}
{%- capture wcp_price -%}{%- render ‘wcp_render_discount’ , wpd_discounted_prices:wpd_discounted_prices, price_variable:‘wcp_price’ -%}{%- endcapture -%}
{% assign wcp_price = wcp_price | minus: 0 %}
{%- capture wcp_compare_at_price -%}{%- render ‘wcp_render_discount’, wpd_discounted_prices:wpd_discounted_prices, price_variable:‘wcp_compare_at_price’ -%}{%- endcapture -%}
{% if wcp_compare_at_price != blank %}
{% assign wcp_compare_at_price = wcp_compare_at_price | minus: 0 %}
{% else %}
{% assign wcp_compare_at_price = nil %}
{% endif %}
{%- capture wcp_compare_at_price_min -%}{%- render ‘wcp_render_discount’ , wpd_discounted_prices:wpd_discounted_prices, price_variable:‘wcp_compare_at_price_min’ -%}{%- endcapture -%}
{% assign wcp_compare_at_price_min = wcp_compare_at_price_min | minus: 0 %}
{%- capture wcp_compare_at_price_max -%}{%- render ‘wcp_render_discount’, wpd_discounted_prices:wpd_discounted_prices, price_variable:‘wcp_compare_at_price_max’ -%}{%- endcapture -%}
{% assign wcp_compare_at_price_max = wcp_compare_at_price_max | minus: 0 %}
{%- capture wcp_price_min -%}{%- render ‘wcp_render_discount’ , wpd_discounted_prices:wpd_discounted_prices, price_variable:‘wcp_price_min’ -%}{%- endcapture -%}
{% assign wcp_price_min = wcp_price_min | minus: 0 %}
{%- capture wcp_price_max -%}{%- render ‘wcp_render_discount’ , wpd_discounted_prices:wpd_discounted_prices, price_variable:‘wcp_price_max’ -%}{%- endcapture -%}
{% assign wcp_price_max = wcp_price_max | minus: 0 %}
{%- capture v_discount_tag -%}{%-render ‘wcp_render_discount’ , wpd_discounted_prices:wpd_discounted_prices, price_variable:‘v_discount_tag’-%}{%- endcapture -%}
{% assign v_discount_tag = v_discount_tag | strip %}
{%- capture p_discount_tag -%}{%- render ‘wcp_render_discount’ , wpd_discounted_prices:wpd_discounted_prices, price_variable:‘p_discount_tag’ -%}{%- endcapture -%}
{% assign p_discount_tag = p_discount_tag | strip %}
{% assign raw_set_prices = product.metafields.wcp_set_prices.wcp_set_prices %}
{% assign set_prices_array = blank %}
{% if raw_set_prices %}
{% assign set_prices_array = raw_set_prices | split: ‘,’ %}
{% endif %}
{%- capture wcp_discount_value -%}{%- render ‘wcp_render_discount’ , wpd_discounted_prices:wpd_discounted_prices, price_variable:‘wcp_discount_value’ -%}{%- endcapture -%}
{% capture wcp_v_discounted_prices %}{%- render ‘wcp_variant’ , wcp_variant:product_card_product.selected_or_first_available_variant , set_prices_array:set_prices_array , wpd_is_render:‘yes’, v_discount_tag : v_discount_tag , wcp_discount_value : wcp_discount_value -%}{%- endcapture -%}
{%- capture wcp_v_price -%}{%- render ‘wcp_render_discount’ , wpd_discounted_prices:wcp_v_discounted_prices, price_variable:‘wcp_v_price’ -%}{%- endcapture -%}
{% assign wcp_v_price = wcp_v_price | minus: 0 %}
{%- capture wcp_v_compare_at_price -%}{%- render ‘wcp_render_discount’ , wpd_discounted_prices:wcp_v_discounted_prices, price_variable:‘wcp_v_compare_at_price’ -%}{%- endcapture -%}
{% if wcp_v_compare_at_price != blank %}
{% assign wcp_v_compare_at_price = wcp_v_compare_at_price | minus: 0 %}
{% else %}
{% assign wcp_v_compare_at_price = nil %}
{% endif %}
{% comment %}
Renders a product card
Accepts:
- product_card_product: {Object} Product Liquid object (optional)
- media_size: {String} Size of the product image card. Values are “square” and “portrait”. Default is “square” (optional)
- show_secondary_image: {Boolean} Show the secondary image on hover. Default: false (optional)
- add_image_padding: {Boolean} Enables padding on the image to space out the grid
- show_vendor: {Boolean} Show the product vendor. Default: false
- show_image_outline: {Boolean} Show card outline. Default: true (optional)
- show_rating: {Boolean} Show the product rating. Default: false
Usage:
{% render ‘product-card’, show_vendor: section.settings.show_vendor %}
{% endcomment %}
{{ ‘component-rating.css’ | asset_url | stylesheet_tag }}
{%- if product_card_product.featured_media -%}
{{ product_card_product.title | escape }}
{%- endif -%}{%- assign inventory = card_product.selected_or_first_available_variant.inventory_quantity -%} {%- if template.name == "collection" and inventory >= 1 -%}Inventory: {{ inventory }}
{%- endif -%}{% comment %} TODO: metafield {% endcomment %}
{{ block.settings.description | escape }}
{%- if show_rating and product_card_product.metafields.reviews.rating.value != blank -%}
{% liquid
assign rating_decimal = 0
assign decimal = product_card_product.metafields.reviews.rating.value.rating | modulo: 1
if decimal >= 0.3 and decimal <= 0.7
assign rating_decimal = 0.5
elsif decimal > 0.7
assign rating_decimal = 1
endif
%}
{{ product_card_product.metafields.reviews.rating.value }} / {{ product_card_product.metafields.reviews.rating.value.scale_max }}
({{ product_card_product.metafields.reviews.rating_count }}) {{ product_card_product.metafields.reviews.rating_count }} {{ "accessibility.total_reviews" | t }}
{%- endif -%} {% render 'price', product: product_card_product, price_class: '' %}if product_card_product.featured_media.aspect_ratio == nil
assign featured_media_aspect_ratio = 1
endif
-%}
<div{% if add_image_padding %} class=“card__media-full-spacer”{% endif %}>
{%- if product_card_product.media[1] != nil and show_secondary_image -%}
<img
srcset=“{%- if product_card_product.media[1].width >= 165 -%}{{ product_card_product.media[1] | img_url: ‘165x’ }} 165w,{%- endif -%}
{%- if product_card_product.media[1].width >= 360 -%}{{ product_card_product.media[1] | img_url: ‘360x’ }} 360w,{%- endif -%}
{%- if product_card_product.media[1].width >= 533 -%}{{ product_card_product.media[1] | img_url: ‘533x’ }} 533w,{%- endif -%}
{%- if product_card_product.media[1].width >= 720 -%}{{ product_card_product.media[1] | img_url: ‘720x’ }} 720w,{%- endif -%}
{%- if product_card_product.media[1].width >= 940 -%}{{ product_card_product.media[1] | img_url: ‘940x’ }} 940w,{%- endif -%}
{%- if product_card_product.media[1].width >= 1066 -%}{{ product_card_product.media[1] | img_url: ‘1066x’ }} 1066w,{%- endif -%}
{{ product_card_product.media[1] | img_url: ‘master’ }} {{ product_card_product.media[1].width }}w”
src=“{{ product_card_product.media[1] | img_url: ‘533x’ }}”
sizes=“(min-width: {{ settings.page_width }}px) {{ settings.page_width | minus: 130 | divided_by: 4 }}px, (min-width: 990px) calc((100vw - 130px) / 4), (min-width: 750px) calc((100vw - 120px) / 3), calc((100vw - 35px) / 2)”
alt=“{{ product_card_product.media[1].alt | escape }}”
loading=“lazy”
class=“motion-reduce”
width=“{{ product_card_product.media[1].width }}”
height=“{{ product_card_product.media[1].height }}”
{%- endif -%}
Hi @MJGTrading ,
Please change all code:
{% capture wpd_discounted_prices %}{%- render 'wcp_discount' wcp_discount:product_card_product , wpd_is_render:'yes' -%}{% endcapture %}
{%- capture wcp_price -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_price' -%}{%- endcapture -%}
{% assign wcp_price = wcp_price | minus: 0 %}
{%- capture wcp_compare_at_price -%}{%- render 'wcp_render_discount', wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_compare_at_price' -%}{%- endcapture -%}
{% if wcp_compare_at_price != blank %}
{% assign wcp_compare_at_price = wcp_compare_at_price | minus: 0 %}
{% else %}
{% assign wcp_compare_at_price = nil %}
{% endif %}
{%- capture wcp_compare_at_price_min -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_compare_at_price_min' -%}{%- endcapture -%}
{% assign wcp_compare_at_price_min = wcp_compare_at_price_min | minus: 0 %}
{%- capture wcp_compare_at_price_max -%}{%- render 'wcp_render_discount', wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_compare_at_price_max' -%}{%- endcapture -%}
{% assign wcp_compare_at_price_max = wcp_compare_at_price_max | minus: 0 %}
{%- capture wcp_price_min -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_price_min' -%}{%- endcapture -%}
{% assign wcp_price_min = wcp_price_min | minus: 0 %}
{%- capture wcp_price_max -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_price_max' -%}{%- endcapture -%}
{% assign wcp_price_max = wcp_price_max | minus: 0 %}
{%- capture v_discount_tag -%}{%-render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'v_discount_tag'-%}{%- endcapture -%}
{% assign v_discount_tag = v_discount_tag | strip %}
{%- capture p_discount_tag -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'p_discount_tag' -%}{%- endcapture -%}
{% assign p_discount_tag = p_discount_tag | strip %}
{% assign raw_set_prices = product.metafields.wcp_set_prices.wcp_set_prices %}
{% assign set_prices_array = blank %}
{% if raw_set_prices %}
{% assign set_prices_array = raw_set_prices | split: ',' %}
{% endif %}
{%- capture wcp_discount_value -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_discount_value' -%}{%- endcapture -%}
{% capture wcp_v_discounted_prices %}{%- render 'wcp_variant' , wcp_variant:product_card_product.selected_or_first_available_variant , set_prices_array:set_prices_array , wpd_is_render:'yes', v_discount_tag : v_discount_tag , wcp_discount_value : wcp_discount_value -%}{%- endcapture -%}
{%- capture wcp_v_price -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wcp_v_discounted_prices, price_variable:'wcp_v_price' -%}{%- endcapture -%}
{% assign wcp_v_price = wcp_v_price | minus: 0 %}
{%- capture wcp_v_compare_at_price -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wcp_v_discounted_prices, price_variable:'wcp_v_compare_at_price' -%}{%- endcapture -%}
{% if wcp_v_compare_at_price != blank %}
{% assign wcp_v_compare_at_price = wcp_v_compare_at_price | minus: 0 %}
{% else %}
{% assign wcp_v_compare_at_price = nil %}
{% endif %}
{% comment %}
Renders a product card
Accepts:
- product_card_product: {Object} Product Liquid object (optional)
- media_size: {String} Size of the product image card. Values are "square" and "portrait". Default is "square" (optional)
- show_secondary_image: {Boolean} Show the secondary image on hover. Default: false (optional)
- add_image_padding: {Boolean} Enables padding on the image to space out the grid
- show_vendor: {Boolean} Show the product vendor. Default: false
- show_image_outline: {Boolean} Show card outline. Default: true (optional)
- show_rating: {Boolean} Show the product rating. Default: false
Usage:
{% render 'product-card', show_vendor: section.settings.show_vendor %}
{% endcomment %}
{{ 'component-rating.css' | asset_url | stylesheet_tag }}
{%- if show_vendor -%}
{{ 'accessibility.vendor' | t }}
{{ product_card_product.vendor }}
{%- endif -%}
{%- if product_card_product.featured_media -%}
###
{{ product_card_product.title | escape }}
{%- endif -%}{%- assign inventory = card_product.selected_or_first_available_variant.inventory_quantity -%}
{%- if template.name == "collection" and inventory >= 1 -%}
Inventory: {{ inventory }}
{%- endif -%}
{% comment %} TODO: metafield {% endcomment %}
{{ block.settings.description | escape }}
{%- if show_rating and product_card_product.metafields.reviews.rating.value != blank -%}
{% liquid
assign rating_decimal = 0
assign decimal = product_card_product.metafields.reviews.rating.value.rating | modulo: 1
if decimal >= 0.3 and decimal <= 0.7
assign rating_decimal = 0.5
elsif decimal > 0.7
assign rating_decimal = 1
endif
%}
{{ product_card_product.metafields.reviews.rating.value }} / {{ product_card_product.metafields.reviews.rating.value.scale_max }}
({{ product_card_product.metafields.reviews.rating_count }})
{{ product_card_product.metafields.reviews.rating_count }} {{ "accessibility.total_reviews" | t }}
{%- endif -%}
{% render 'price', product: product_card_product, price_class: '' %}
{%- if product_card_product.featured_media -%}
{%- liquid
assign featured_media_aspect_ratio = product_card_product.featured_media.aspect_ratio
if product_card_product.featured_media.aspect_ratio == nil
assign featured_media_aspect_ratio = 1
endif
-%}
{%- else -%}
##
{{ product_card_product.title }}
{%- endif -%}
{%- if product_card_product.available == false -%}
{{ 'products.product.sold_out' | t }}
{%- elsif wcp_compare_at_price > wcp_price and product_card_product.available -%}
{{ 'products.product.on_sale' | t }}
{%- endif -%}
{%- if product_card_product.selected_or_first_available_variant.inventory_management == 'shopify' -%}
{%- if product_card_product.selected_or_first_available_variant.inventory_quantity > 0 -%}
{{- product_card_product.selected_or_first_available_variant.inventory_quantity -}}
{%- else -%}
{%- if product_card_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 -%}
{% if variant.available %}
{{ variant.inventory_quantity }} Now In stock
{% endif %}
That Worked thank you thank you. Is it possible to bold that number and or say in stock next to it.
Hi @MJGTrading ,
Please change code here:
Code:
{%- if product_card_product.selected_or_first_available_variant.inventory_management == 'shopify' -%}
{%- if product_card_product.selected_or_first_available_variant.inventory_quantity > 0 -%}
{{-
'products.product.inventory_in_stock_show_count'
| t: quantity: product_card_product.selected_or_first_available_variant.inventory_quantity
-}}
{%- else -%}
{%- if product_card_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 change kicked back an error.
Hi @MJGTrading ,
Please change all code:
{% capture wpd_discounted_prices %}{%- render 'wcp_discount' wcp_discount:product_card_product , wpd_is_render:'yes' -%}{% endcapture %}
{%- capture wcp_price -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_price' -%}{%- endcapture -%}
{% assign wcp_price = wcp_price | minus: 0 %}
{%- capture wcp_compare_at_price -%}{%- render 'wcp_render_discount', wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_compare_at_price' -%}{%- endcapture -%}
{% if wcp_compare_at_price != blank %}
{% assign wcp_compare_at_price = wcp_compare_at_price | minus: 0 %}
{% else %}
{% assign wcp_compare_at_price = nil %}
{% endif %}
{%- capture wcp_compare_at_price_min -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_compare_at_price_min' -%}{%- endcapture -%}
{% assign wcp_compare_at_price_min = wcp_compare_at_price_min | minus: 0 %}
{%- capture wcp_compare_at_price_max -%}{%- render 'wcp_render_discount', wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_compare_at_price_max' -%}{%- endcapture -%}
{% assign wcp_compare_at_price_max = wcp_compare_at_price_max | minus: 0 %}
{%- capture wcp_price_min -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_price_min' -%}{%- endcapture -%}
{% assign wcp_price_min = wcp_price_min | minus: 0 %}
{%- capture wcp_price_max -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_price_max' -%}{%- endcapture -%}
{% assign wcp_price_max = wcp_price_max | minus: 0 %}
{%- capture v_discount_tag -%}{%-render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'v_discount_tag'-%}{%- endcapture -%}
{% assign v_discount_tag = v_discount_tag | strip %}
{%- capture p_discount_tag -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'p_discount_tag' -%}{%- endcapture -%}
{% assign p_discount_tag = p_discount_tag | strip %}
{% assign raw_set_prices = product.metafields.wcp_set_prices.wcp_set_prices %}
{% assign set_prices_array = blank %}
{% if raw_set_prices %}
{% assign set_prices_array = raw_set_prices | split: ',' %}
{% endif %}
{%- capture wcp_discount_value -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_discount_value' -%}{%- endcapture -%}
{% capture wcp_v_discounted_prices %}{%- render 'wcp_variant' , wcp_variant:product_card_product.selected_or_first_available_variant , set_prices_array:set_prices_array , wpd_is_render:'yes', v_discount_tag : v_discount_tag , wcp_discount_value : wcp_discount_value -%}{%- endcapture -%}
{%- capture wcp_v_price -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wcp_v_discounted_prices, price_variable:'wcp_v_price' -%}{%- endcapture -%}
{% assign wcp_v_price = wcp_v_price | minus: 0 %}
{%- capture wcp_v_compare_at_price -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wcp_v_discounted_prices, price_variable:'wcp_v_compare_at_price' -%}{%- endcapture -%}
{% if wcp_v_compare_at_price != blank %}
{% assign wcp_v_compare_at_price = wcp_v_compare_at_price | minus: 0 %}
{% else %}
{% assign wcp_v_compare_at_price = nil %}
{% endif %}
{% comment %}
Renders a product card
Accepts:
- product_card_product: {Object} Product Liquid object (optional)
- media_size: {String} Size of the product image card. Values are "square" and "portrait". Default is "square" (optional)
- show_secondary_image: {Boolean} Show the secondary image on hover. Default: false (optional)
- add_image_padding: {Boolean} Enables padding on the image to space out the grid
- show_vendor: {Boolean} Show the product vendor. Default: false
- show_image_outline: {Boolean} Show card outline. Default: true (optional)
- show_rating: {Boolean} Show the product rating. Default: false
Usage:
{% render 'product-card', show_vendor: section.settings.show_vendor %}
{% endcomment %}
{{ 'component-rating.css' | asset_url | stylesheet_tag }}
{%- if show_vendor -%}
{{ 'accessibility.vendor' | t }}
{{ product_card_product.vendor }}
{%- endif -%}
{%- if product_card_product.featured_media -%}
###
{{ product_card_product.title | escape }}
{%- endif -%}{%- assign inventory = card_product.selected_or_first_available_variant.inventory_quantity -%}
{%- if template.name == "collection" and inventory >= 1 -%}
Inventory: {{ inventory }}
{%- endif -%}
{% comment %} TODO: metafield {% endcomment %}
{{ block.settings.description | escape }}
{%- if show_rating and product_card_product.metafields.reviews.rating.value != blank -%}
{% liquid
assign rating_decimal = 0
assign decimal = product_card_product.metafields.reviews.rating.value.rating | modulo: 1
if decimal >= 0.3 and decimal <= 0.7
assign rating_decimal = 0.5
elsif decimal > 0.7
assign rating_decimal = 1
endif
%}
{{ product_card_product.metafields.reviews.rating.value }} / {{ product_card_product.metafields.reviews.rating.value.scale_max }}
({{ product_card_product.metafields.reviews.rating_count }})
{{ product_card_product.metafields.reviews.rating_count }} {{ "accessibility.total_reviews" | t }}
{%- endif -%}
{% render 'price', product: product_card_product, price_class: '' %}
{%- if product_card_product.featured_media -%}
{%- liquid
assign featured_media_aspect_ratio = product_card_product.featured_media.aspect_ratio
if product_card_product.featured_media.aspect_ratio == nil
assign featured_media_aspect_ratio = 1
endif
-%}
{%- else -%}
##
{{ product_card_product.title }}
{%- endif -%}
{%- if product_card_product.available == false -%}
{{ 'products.product.sold_out' | t }}
{%- elsif wcp_compare_at_price > wcp_price and product_card_product.available -%}
{{ 'products.product.on_sale' | t }}
{%- endif -%}
{%- if product_card_product.selected_or_first_available_variant.inventory_management == 'shopify' -%}
{%- if product_card_product.selected_or_first_available_variant.inventory_quantity > 0 -%}
{{-
'products.product.inventory_in_stock_show_count'
| t: quantity: product_card_product.selected_or_first_available_variant.inventory_quantity
-}}
{%- else -%}
{%- if product_card_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 -%}
{% if variant.available %}
{{ variant.inventory_quantity }} Now In stock
{% endif %}
here is what the rror it kicks back under the item
Translation missing: en.products.product.inventory_in_stock_s
Hi @MJGTrading ,
Please change all code:
{% capture wpd_discounted_prices %}{%- render 'wcp_discount' wcp_discount:product_card_product , wpd_is_render:'yes' -%}{% endcapture %}
{%- capture wcp_price -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_price' -%}{%- endcapture -%}
{% assign wcp_price = wcp_price | minus: 0 %}
{%- capture wcp_compare_at_price -%}{%- render 'wcp_render_discount', wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_compare_at_price' -%}{%- endcapture -%}
{% if wcp_compare_at_price != blank %}
{% assign wcp_compare_at_price = wcp_compare_at_price | minus: 0 %}
{% else %}
{% assign wcp_compare_at_price = nil %}
{% endif %}
{%- capture wcp_compare_at_price_min -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_compare_at_price_min' -%}{%- endcapture -%}
{% assign wcp_compare_at_price_min = wcp_compare_at_price_min | minus: 0 %}
{%- capture wcp_compare_at_price_max -%}{%- render 'wcp_render_discount', wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_compare_at_price_max' -%}{%- endcapture -%}
{% assign wcp_compare_at_price_max = wcp_compare_at_price_max | minus: 0 %}
{%- capture wcp_price_min -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_price_min' -%}{%- endcapture -%}
{% assign wcp_price_min = wcp_price_min | minus: 0 %}
{%- capture wcp_price_max -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_price_max' -%}{%- endcapture -%}
{% assign wcp_price_max = wcp_price_max | minus: 0 %}
{%- capture v_discount_tag -%}{%-render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'v_discount_tag'-%}{%- endcapture -%}
{% assign v_discount_tag = v_discount_tag | strip %}
{%- capture p_discount_tag -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'p_discount_tag' -%}{%- endcapture -%}
{% assign p_discount_tag = p_discount_tag | strip %}
{% assign raw_set_prices = product.metafields.wcp_set_prices.wcp_set_prices %}
{% assign set_prices_array = blank %}
{% if raw_set_prices %}
{% assign set_prices_array = raw_set_prices | split: ',' %}
{% endif %}
{%- capture wcp_discount_value -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wpd_discounted_prices, price_variable:'wcp_discount_value' -%}{%- endcapture -%}
{% capture wcp_v_discounted_prices %}{%- render 'wcp_variant' , wcp_variant:product_card_product.selected_or_first_available_variant , set_prices_array:set_prices_array , wpd_is_render:'yes', v_discount_tag : v_discount_tag , wcp_discount_value : wcp_discount_value -%}{%- endcapture -%}
{%- capture wcp_v_price -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wcp_v_discounted_prices, price_variable:'wcp_v_price' -%}{%- endcapture -%}
{% assign wcp_v_price = wcp_v_price | minus: 0 %}
{%- capture wcp_v_compare_at_price -%}{%- render 'wcp_render_discount' , wpd_discounted_prices:wcp_v_discounted_prices, price_variable:'wcp_v_compare_at_price' -%}{%- endcapture -%}
{% if wcp_v_compare_at_price != blank %}
{% assign wcp_v_compare_at_price = wcp_v_compare_at_price | minus: 0 %}
{% else %}
{% assign wcp_v_compare_at_price = nil %}
{% endif %}
{% comment %}
Renders a product card
Accepts:
- product_card_product: {Object} Product Liquid object (optional)
- media_size: {String} Size of the product image card. Values are "square" and "portrait". Default is "square" (optional)
- show_secondary_image: {Boolean} Show the secondary image on hover. Default: false (optional)
- add_image_padding: {Boolean} Enables padding on the image to space out the grid
- show_vendor: {Boolean} Show the product vendor. Default: false
- show_image_outline: {Boolean} Show card outline. Default: true (optional)
- show_rating: {Boolean} Show the product rating. Default: false
Usage:
{% render 'product-card', show_vendor: section.settings.show_vendor %}
{% endcomment %}
{{ 'component-rating.css' | asset_url | stylesheet_tag }}
{%- if show_vendor -%}
{{ 'accessibility.vendor' | t }}
{{ product_card_product.vendor }}
{%- endif -%}
{%- if product_card_product.featured_media -%}
###
{{ product_card_product.title | escape }}
{%- endif -%}{%- assign inventory = card_product.selected_or_first_available_variant.inventory_quantity -%}
{%- if template.name == "collection" and inventory >= 1 -%}
Inventory: {{ inventory }}
{%- endif -%}
{% comment %} TODO: metafield {% endcomment %}
{{ block.settings.description | escape }}
{%- if show_rating and product_card_product.metafields.reviews.rating.value != blank -%}
{% liquid
assign rating_decimal = 0
assign decimal = product_card_product.metafields.reviews.rating.value.rating | modulo: 1
if decimal >= 0.3 and decimal <= 0.7
assign rating_decimal = 0.5
elsif decimal > 0.7
assign rating_decimal = 1
endif
%}
{{ product_card_product.metafields.reviews.rating.value }} / {{ product_card_product.metafields.reviews.rating.value.scale_max }}
({{ product_card_product.metafields.reviews.rating_count }})
{{ product_card_product.metafields.reviews.rating_count }} {{ "accessibility.total_reviews" | t }}
{%- endif -%}
{% render 'price', product: product_card_product, price_class: '' %}
{%- if product_card_product.featured_media -%}
{%- liquid
assign featured_media_aspect_ratio = product_card_product.featured_media.aspect_ratio
if product_card_product.featured_media.aspect_ratio == nil
assign featured_media_aspect_ratio = 1
endif
-%}
{%- else -%}
##
{{ product_card_product.title }}
{%- endif -%}
{%- if product_card_product.available == false -%}
{{ 'products.product.sold_out' | t }}
{%- elsif wcp_compare_at_price > wcp_price and product_card_product.available -%}
{{ 'products.product.on_sale' | t }}
{%- endif -%}
{%- if product_card_product.selected_or_first_available_variant.inventory_management == 'shopify' -%}
{%- if product_card_product.selected_or_first_available_variant.inventory_quantity > 0 -%}
In stock: {{ product_card_product.selected_or_first_available_variant.inventory_quantity
}}
{%- else -%}
{%- if product_card_product.selected_or_first_available_variant.inventory_policy == 'continue' -%}
In stock
{%- else -%}
Out of stock
{%- endif -%}
{%- endif -%}
{%- endif -%}
{% if variant.available %}
{{ variant.inventory_quantity }} Now In stock
{% endif %}
FANTASTIC it worked THANK YOU THANK YOU
Hi @MJGTrading ,
You’re welcome and happy to help ![]()


