Focusing on managing products, variants, and collections through the API.
Good day!
We're having some technical difficulties in our Shopify store where a collection is missing from the /collections page: https://www.htm-lighting.com/collections
This is the link of the missing collection: https://www.htm-lighting.com/collections/warehouse-shade-with-gooseneck
As you can see the link is accessible so that means the 'Warehouse Shade With Gooseneck' collection is published.
On our homepage there's a section called 'Featured Collections' that dynamically displays some of our collections such as the 'Warehouse Shade With Gooseneck' collection. The image, title, and url of each collections are being called in our {% for %} loop code.
Please refer to the screenshot url below:
https://prnt.sc/FX5nG_1TFqW2
(Once you check the homepage this may not be the output on your end. We'll temporarily hard code the display of 'Warehouse Shade With Gooseneck' for now.)
Note that this was already working and no current changes were made to the conditional code for displaying the said collection.
Please refer to screenshot below for the {% for %} loop code:
https://ibb.co/jZRPcLd
The suspected issue why the conditional code is not working for 'Warehouse Shade With Gooseneck' is that this collection is missing on the /collections page even though the collection's status is published.
What are the possible reason why this bug is occurring and what can be done to fix this issue on our end?
Hey @AOCSupport
Looking through the collections JSON, I can see it on the fifth page (250 per page): https://www.htm-lighting.com/collections.json?limit=250&page=5
Looking at the collections page, it appears there are exactly 1,000 collections displayed. This feels like it could be a pagination issue. Consider adding some pagination links (or lazy-loading) to get the next page of results. You could also reduce this current 1,000 limit to increase performance while you're at it.
Let me know how you go!
Scott | Developer Advocate @ Shopify
Hi Scott!
Thank you for this and we can confirm this on our end. Although in our for loop code below:
{% for collection in collections %}
<!-- To display all available collection -->
<span>{{ collection.title }}</span><br/>
<!-- Just to confirm if the specified collections are in the collections array -->
{% case collection.title %}
{% when 'Warehouse Shade With Gooseneck' %}
<h1>Warehouse Shade With Gooseneck is showing</h1>
{% when 'Test Collection' %}
<h1>Test Collection is showing</h1>
{% when 'Angle Shade With Gooseneck' %}
<h1>Angle Shade With Gooseneck is showing</h1>
{% endcase %}
{% endfor %}
The said collection is still missing on the for loop and as you can see there's a Test Collection(newly added collection) where it gets the same result to Warehouse Shade With Gooseneck.
I believe there's nothing wrong with the for loop code as this was already working before on our end. What else can be the possible cause of this issue?
Hey @AOCSupport
Where is this code running - on the collections list, or home page? and have you paginated? The 1,000 limit might still be applying (this product would be ~1,050)
Scott | Developer Advocate @ Shopify