How can I fix product display for multiple categories?

Topic summary

Issue Resolved: A user encountered a problem where custom code displaying product inventory by category only worked for one collection (“Fiberglass Rolls and Strips”) despite the product belonging to multiple categories.

Solution: The issue self-resolved after waiting for Shopify to activate the category. The user confirmed the code is now functioning correctly.

New Question: The user now wants to modify the code to display inventory information only when the collection is active on the “online store” sales channel. This remains an open question awaiting response.

Technical Context: The implementation uses Liquid template code that loops through product collections and conditionally displays variant inventory quantities in a table format.

Summarized with AI on November 21. AI used: claude-sonnet-4-5-20250929.

I am displaying text based on product category…the product is in both categories, but only displaying for “Fiberglass Rolls and Strips” collection.

How do i fix th

        
  {% for collection in product.collections %}
    {% if collection.title == 'Vacation' %}

| **Current Stock** |
| - |
| <br>          <br>                <br><br>        {%- for variant in product.variants -%}<br>          {%- if variant.inventory_quantity > 0 -%}<br>          - {{ variant.title }} - {{ variant.inventory_quantity }} in stock<br>          {%- endif -%}<br>        {%- endfor -%}<br>          <br><br>          <br>           |

      {% break %}
    {% endif %}
  {% endfor %}
 

          
  {% for collection in product.collections %}
    {% if collection.title == 'Fiberglass Rolls and Strips' %}

| **Current Stock** |
| - |
| <br>          <br>                <br><br>        {%- for variant in product.variants -%}<br>          {%- if variant.inventory_quantity > 0 -%}<br>          - {{ variant.title }} - {{ variant.inventory_quantity }} in stock<br>          {%- endif -%}<br>        {%- endfor -%}<br>          <br><br>          <br>           |

      {% break %}
    {% endif %}
  {% endfor %}

OK, its working now…had to wait for Shopify to make the category active

Now I have another question…can i adjust the code to onlt display if the Collection is active on “online store” sales channel