To access specific collection attributes, you must know collection handle and use this kind of code :

{{ collections['the-handle'].url }}

So to achieve what you want to do, here is what you could do:

{% assign collection_handle = 'the-handle-of-collection-you-want' %}
{% for product in collections[collection_handle].products %}
    Do your stuff
{% endfor %}

Note that you cannot access a collection through its title. Only handle.

Learning more about what's handle: https://help.shopify.com/themes/liquid/basics/handle

HTH

Answer from Alice Girard on Stack Overflow
🌐
Shopify
shopify.dev › docs › api › admin-graphql › latest › queries › collectionbyhandle
collectionByHandle - GraphQL Admin
const client = new shopify.clients.Graphql({session}); const data = await client.query({ data: { "query": `query getCollectionIdFromHandle($handle: String!) { collectionByHandle(handle: $handle) { id } }`, "variables": { "handle": "ipods" }, }, }); { "collectionByHandle": { "id": "gid://shopify/Collection/841564295" } } Retrieve a collection by a handle that doesn't exist
🌐
Entaice
entaice.com › blog › shopify-liquid-get-collection-by-handle
How to Fetch Collections in Shopify Using Liquid's Handle | Entaice
September 7, 2023 - To grab a collection by its handle in Liquid, you’ll be using something called an object. In Shopify’s Liquid world, objects hold data about different parts of your store like products, ...
🌐
HulkApps
hulkapps.com › home › shopify hub › a complete guide on how to get collection handle in shopify
A Complete Guide on How to Get Collection Handle in Shopify
April 11, 2024 - This identifier is crucial when customizing collection pages, implementing dynamic content, or creating conditional logic based on the collection being viewed. Accessing a collection handle can be achieved by tapping into Shopify's Liquid objects.
🌐
Foobartel
foobartel.com › articles › shopify-collections
Shopify: Achieving Collections in Collections - foobartel.com
Now that we have found a way to display all collections that belong to a certain looks category, I want to display a look and its products when selected. I’m checking for the current handle and if the handle contains “looks-girls-“ – again, the trailing dash is the important part here – we’re getting the required information as well as the contained products.
Find elsewhere
🌐
Shopify Help Center
help.shopify.com › en › manual › shopify-flow › reference › actions › get-collection-data
Shopify Help Center | Get collection data
In workflows that require collection data, you can use the Get collection data action to retrieve collection information from your store.
🌐
Shopify
shopify.dev › docs › api › liquid › objects › collection
Liquid objects: collection
The handle of the collection. ... The ID of the collection. ... The image for the collection. This image is added on the collection's page in the Shopify admin.
🌐
Shopify Community
community.shopify.com › shopify discussion
Loop through a collection using a collection ID
May 15, 2023 - Hi there, Trying to figure out how to loop through a collection using the collection ID. Is this possible? Right now I’m using the collection name, ie: collections['collection-name'].products but needing to transition a…
🌐
Shopify Community
community.shopify.com › c › shopify-design › if-collection-handle-accessories › td-p › 442731
{% if collection.handle == 'Accessories' %} - Shopify Community
September 4, 2021 - Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type. ... Want to help improve the Shopify Community? Share your feedback for a chance to win a one month Shopify subscription credit. ... I'm trying to write code that basically says: If a products collection = Accessories, add this chunk of code into it. I'm sure i'm missing something pretty simple but I don't want to waste time on this. Can you please help? {% if collection.handle == 'Accessories' %} <p>This product is an accessory</p> {% endif %}
🌐
Shopify Community
community.shopify.com › technical q&a
Capturing Article.Handle and using it to find a Collection with that handle - Shopify Community
December 6, 2022 - Hi all. I’m a bit stuck on this one. I’ve done something before but cannot for the life of me remember how to do it. Any help is greatly apprecited. I’m trying to show a Collection on a Blog Article Page. The Collection I need to show has the same handle as the blog article.
🌐
GitHub
github.com › Shopify › js-buy-sdk › issues › 648
How to fetch collection by handle and sort at the same time?? · Issue #648 · Shopify/js-buy-sdk
February 9, 2019 - const fetchProductsInCollection = async (client, handle = null) => { // Fetch a single collection by ID, including its products let res; try { res = await client.collection.fetchByHandle(handle); return res; } catch (error) { console.log(error); throw new Error(error); } };
Published   Mar 26, 2019
🌐
Shopify Community
community.shopify.com › technical q&a
If product is in a specific collection, show specific code on page
April 14, 2022 - So I am working on a product specifications table for our website and I would like for the code to show certain aspects of that table based off an if else or case statement. For example, we have various appliances and i…
🌐
Shopify
shopify.dev › docs › api › admin-rest › latest › resources › collection
Collection
// Session is built by the OAuth process await shopify.rest.Collection.find({ session: session, id: 841564295, }); HTTP/1.1 200 OK{"collection":{"id":841564295,"handle":"ipods","title":"IPods","updated_at":"2008-02-01T19:00:00-05:00","body_html":"<p>The best selling ipod ever</p>","published_at":"2008-02-01T19:00:00-05:00","sort_order":"manual","template_suffix":null,"products_count":1,"collection_type":"custom","published_scope":"web","admin_graphql_api_id":"gid://shopify/Collection/841564295","image":{"created_at":"2025-10-01T15:04:04-04:00","alt":"MP3 Player 8gb","width":123,"height":456,"src":"https://cdn.shopify.com/s/files/1/0005/4838/0009/collections/ipod_nano_8gb.jpg?v=1759345444"}}}