Repository navigation
Shopify sold-out label ignores the selected variant? Check availability #43
vistabylara-dev
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
حالة توفر المنتج ككل قد تختلف عن حالة المقاس أو اللون المختار.
Free Shopify code series · 40/50 · Reviewed 24 October 2026
The problem
A product may have one available variant while the selected variant is unavailable. A selected-variant status should use that variant's available property.
Placement and precautions
Duplicate the theme and work in its unpublished preview. Save the original files and change one component at a time.
Adapt the existing product status component and merge the locale keys. Keep the same current-variant source and update flow as the actual purchase form.
Bounded Liquid example — not a replacement for an entire theme file:
{% assign stock_variant = product.selected_or_first_available_variant %} {% if stock_variant != blank %} <p class="vbl-stock-status"> {% if stock_variant.available %} {{ 'vbl_40.available' | t }} {% else %} {{ 'vbl_40.unavailable' | t }} {% endif %} </p> {% endif %}Translation keys: Merge this object into the root of the existing locales/en.default.json, keeping all other keys and valid commas. Add corresponding translations to every active language file. Replace generic example wording with accurate store content. Do not replace the entire locale file.
{ "vbl_40": { "available": "Available", "unavailable": "Unavailable" } }Check in preview
Test available, unavailable and continue-selling variants in a development catalogue. Switch options without reload and confirm the text stays consistent with the purchase control.
Limits to understand
Availability is not simply inventory_quantity greater than zero. The example is a label, not a stock-enforcement system or a replacement for checkout validation.
Validation: This code and locale JSON passed Shopify's validation tool. This is static validation, not proof of rendering, accessibility, theme compatibility, indexing or improved sales. No live merchant store was changed or purchase performed.
Rollback
Restore the saved markup and styles if anything regresses. Remove any new calls before deleting their referenced files. Remove only unused locale keys introduced for this example. Keep the previous working theme available until the full affected journey has been checked.
Need this fixed in your store?
Send Dr Lara your store URL, theme name, affected page and what changed before the issue started. Start with free guidance and a free initial consultation. If you want implementation, we agree the scope and fee separately before work starts.
Explore Shopify repairs and development with Vista by Lara
WhatsApp Dr Lara about guide 40 or call +971 50 799 4292.
Free guidance. No commitment. Practical implementation is separately scoped.
Join the discussion
What result do you see, and what should happen instead? Share a short sanitized example. Remove passwords, tokens, customer details and private admin URLs.
Official references
Dr Lara · Vista by Lara · Dubai, UAE
All reactions