Hello, when a product is set to “continue to sell after sold out” it will show the product as in stock when there is an incoming transfer. Like her: (I want to hide the highlighted element, but keep it working for other products aswell).
Here is the code for the widget:
{%- assign inventory_visible = false -%}
{%- if current_variant.inventory_management == 'shopify' -%}
{%- if current_variant.inventory_quantity <= block.settings.inventory_threshold and current_variant.inventory_quantity >= 0 -%}
{%- assign inventory_visible = true -%}
{%- endif -%}
{%- endif -%}
{%- liquid
if current_variant.inventory_quantity == 0 or current_variant.inventory_policy == 'continue'
assign inventory_visible = false
endif
assign show_incoming = false
if current_variant.incoming and inventory_visible == false and current_variant.inventory_quantity <= block.settings.inventory_threshold
assign show_incoming = true
endif
-%}
- {%- if inventory_visible -%}
{{ 'products.product.stock_label' | t: count: current_variant.inventory_quantity }}
{%- else -%}
{{ 'products.product.in_stock_label' | t }}
{%- endif -%}
{%- if block.settings.inventory_transfers_enable -%}
- {%- if current_variant.next_incoming_date -%}
{%- assign date = current_variant.next_incoming_date | date: format: 'date' -%}
{%- if current_variant.available -%}
{{ 'products.product.will_not_ship_until' | t: date: date }}
{%- else -%}
{{ 'products.product.will_be_in_stock_after' | t: date: date }}
{%- endif -%}
{%- else -%}
{{ 'products.product.waiting_for_stock' | t }}
{%- endif -%}
{%- endif -%}
{%- assign variants_with_inventory_tracking = product.variants | where: 'inventory_management', 'shopify' -%}
{% comment %}
If loaded in quick view, it might be from a JS-loaded function
that loads recommended products. If that's the case, the above
JS will not set the variant inventory. Add it to an accessible
data div to read later instead.
{% endcomment %}
{%- for variant in variants_with_inventory_tracking -%}
{%- endfor -%}
