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 › liquid › objects › collection
Liquid objects: collection
Only filters relevant to the current collection are returned. Filters will be empty for collections that contain over 5000 products. To learn about supporting filters in your theme, refer to Support storefront filtering. ... The handle of the collection.
🌐
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 - A collection handle is a unique, ... code. ... You can find a collection's handle by accessing the 'handle' attribute of the 'collection' Liquid object on collection pages....
🌐
ShopKeeper
shopkeepertools.com › docs › global-content › product-collections
Output Based on Product Collections | ShopKeeper
This code will output different text based on what collection your product is in. This code works by checking the handle of collections. Add this Code to My Content Change the values in bold to fit your needs. Be sure the "use Liquid" checkbox is checked. {% assign collection_handles = product.collections |…
🌐
Pipiads
pipiads.com › blog › shopify-liquid-get-collection-by-handle
shopify liquid get collection by handle
We also learned how to access link lists using their handle with bracket notation, how to loop over links in a link list using liquid tags, and how to display link information using liquid objects such as link.title and link.url. By using these techniques, we can easily create a dynamic and customizable navigation menu that enhances the user experience on our Shopify site. Hey, welcome to another video! In this video, we will be working on the collection ...
Find elsewhere
🌐
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…
🌐
GitHub
gist.github.com › 1002801 › 0c1c54333ce052f4cc202a766a51925acc4c190c
Related Products — to add to product.liquid
{% if collection and collection.all_products_count > 4 %} {% assign col = collection.handle %} {% else %} {% assign col = product.collections.last.handle %} {% endif %} {% for tag in product.tags %} {% if tag contains 'meta-related-collection-' %} {% assign col = tag | remove: 'meta-related-collection-' %} {% assign collection = collections[col] %} {% capture limit %}{{ collection.products_count | plus: 1 }}{% endcapture %} {% endif %} {% endfor %} {% if col and collections[col].all_products_count > 0 %} <br class="clear" /> <br class="clear" /> <h4 class="title center">{{ 'products.product.re
🌐
Foobartel
foobartel.com › articles › shopify-collections
Shopify: Achieving Collections in Collections - foobartel.com
The collection.looks.liquid file contains the following code: First of all, I’m checking if the current collection handle is “looks-girls”. If that’s the case, I go ahead and find all collections with a name containing “looks-girls-“ — the important part here is the trailing “-“ in the handle.
🌐
Work From Somewhere
workfromsomewhere.com › home › shopify liquid: only display if in a specific collection
Shopify Liquid: Only display if in a specific collection
December 26, 2021 - {% for c in product.collections %} {% if c.handle == "collection-handle" %} Input custom text here. HTML is fine, as are other liquid modifiers.
🌐
Markdunkley
cheat.markdunkley.com
Shopify Cheat Sheet - Liquid variables
If using a custom product template (like product.bike-landing.liquid) then it will return the name of the template (bike-landing) ... Returns the variant object if passed in through the url (ex: ?variant=123 would return "123"). ... Returns the variant objet if there is a ?variant= url parameter. If there is no param the first variant with inventory will be selected. ... Returns a list of collections a product is listed in. ... Returns a list of the product's tags (represented by simple strings).
🌐
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
shopify.github.io › liquid-code-examples › example › collection-list
Collection list | Shopify Liquid code examples
--> {%- if collection.image -%} {%- assign collection_image = collection.image -%} {%- elsif collection.products.first and collection.products.first.images != empty -%} {%- assign collection_image = collection.products.first.featured_image -%} {%- else -%} {%- assign collection_image = blank -%} {%- endif -%} <a href="{{ collection.url }}"> <img src="{{ collection_image | img_url: '480x' }}" alt=""> {{ collection.title }} </a> </li> {%- endfor -%} </ul>