I have a carousel on my collection page that lists sub-collections. All their names start with “Men’s”, which looks repetitive when displayed together. I want to show a shorter label (e.g., “T-Shirts” instead of “Men’s T-Shirts”) in the carousel only, without renaming the actual collections.
My carousel is driven by a dynamic collection list metafield, so the title comes from collection.title in the Liquid code. I created a custom.display_name metafield but I’m not sure how to wire it up cleanly.
@MEZ_MUS your custom.display_name metafield is the right move. Swap the title output in your carousel loop for {{ collection.metafields.custom.display_name.value | default: collection.title }} - set that metafield only on the collections you want shortened, everything else falls back to the real title automatically. No app needed. Hope that helps
A Big yes, we can display the collection Shorter without changing the real collection name :
Adding the custom name via a metafield :
We could add a collection metafield specifically designed for our carousel. Thus, we will not change the actual name of the collection, but we can show the abbreviated version within the carousel.
for instance :
Collection name: Men’s T-Shirts
Carousel display name: T-Shirts
Then we could use metafield value in our carousel as the display name with the fallback to the original title if it does not exist. Code : {{ collection.metafields.custom.display_name | default: collection.title }}
This is the best approach if we wanted complete freedom in naming collections.
2 – Automatically strip “Men’s” using Liquid Code
all the collection names begin with the phrase "Men’s ", we could strip it when rendering the title in the carousel. Code : {{ collection.title | remove: "Men's " }} Or {{ collection.title | remove_first: "Men's " }}
if we wanted to strip it only at the beginning of the title.
metafield route is the way to go here, works fine on carousels. just watch out for the fallback so collections without the metafield still show their normal title. i also had to clear the theme cache before the new labels showed up, took me a while to figure that one out.
@MEZ_MUS Metafield route is well covered above, so just flagging two things in the snippets that will bite you later.
remove_first removes the first occurrence anywhere in the string, not just at the start. You said everything begins with Mens so youre fine today, but the first time you add something like Kids and Mens Accessories it quietly becomes Kids and Accessories and nobody notices for months.
The split and slice fallback has a worse version of the same problem. It drops the first word of every title unconditionally, so any collection that doesnt start with Mens loses a word, and a single word collection comes out blank.
This handles both, and covers the straight and curly apostrophe at the same time so you dont have to work out which one your titles use:
Only strips when the title actually starts with it, leaves everything else alone, and the metafield still overrides when you want a completely different label.
One other thing. Note down wherever you make this edit. Theme updates overwrite section files, and this is exactly the kind of small change that vanishes six months later with nobody remembering it was there.
Hi @MEZ_MUS Welcome To Shopify Community So Since you already have the custom.display_name metafield created on your collections, the fix is just swapping which value the carousel loop pulls from, with a fallback in case a collection doesn’t have the metafield set yet.
In the Liquid file where the carousel renders each collection’s title (likely something like a for collection in collection_list loop), replace the direct collection.title reference with a check for the metafield first:
Then use {{ display_title }} wherever the carousel currently outputs {{ collection.title }}. The default filter means any collection where you haven’t set the metafield yet will just fall back to showing the normal title, so you can update collections gradually instead of needing to fill in every single one before it works.
One thing to double check: make sure the metafield type is set to “Single line text” (not rich text or another type), since rich text metafields need .value handled slightly differently (usually wrapped with the metafield_tag filter or rendered as HTML) to avoid printing raw HTML tags in your carousel. Hope this helps solve your problem, and if it does, don’t forget to like and mark it as the solution. Thank you!
I’d keep the collection title untouched and only change the label where the carousel prints it, so the rest of the theme still uses the real collection name.
Then, make the snippet read the metafield first and fall back to the title when it’s blank, then only populate custom.display_name on the collections that need the shorter label. That keeps you from having to maintain a second naming system across every collection.
Plus, if your theme editor lets you choose the collection list source, make sure the carousel is pulling the collection object itself and not a hardcoded title string.
Hi @MEZ_MUS no, not automatically. Collection names/titles are stored in Shopify’s database (product/collection data), completely separate from theme files, so a theme update never touches those, your custom.display_name metafield values and collection titles stay exactly as you set them regardless of theme updates.
Theme code is different though — if you’re on a Shopify-managed theme (installed from the Theme Store, receiving automatic updates), an update can overwrite files if you edited them directly, since Shopify’s update process replaces the base theme files. If you added the display_title Liquid code (from the metafield fix) directly into a core file that gets touched by updates, there’s a real risk it gets wiped on the next update, unless you’re using an “Edit code” duplicate/unpublished theme copy or Shopify’s theme update actually merges custom changes intelligently (which newer Online Store 2.0 themes handle better than older ones, but it’s not guaranteed for every file).
Safest practice: keep a duplicate of your theme (the one you actually edit) separate from any “live, auto-updating” copy if your theme supports auto-updates, or document exactly which files/sections you’ve customized so you can quickly re-apply changes if an update does overwrite something.
Since you already have the custom.display_name metafield on each collection, you can use it as an override rather than changing the collection title itself.
Where the carousel currently outputs collection.title, try:
collection.metafields.custom.display_name default: collection. Title
That keeps the actual collection name unchanged and only uses the shorter label in this carousel. The default also gives you a fallback to the normal collection title when no custom display name is set.
i do not know exactly where i shoud edit or add this code in Theme Editor. I see something like collection_list or collection.title or Carousel.liquid … also i am not familiar with CSS or HTML
Save and preview the duplicate. Test one collection with custom.display_name filled in and one where it is blank. The blank one should still show its normal collection title.
The metafield should be a single-line text field with the namespace and key custom.display_name. You can check the definition under Settings > Metafields and metaobjects > Collections, then enter the short label on each relevant collection page under Products > Collections.
If the matching line contains anything else, or if you find several matches, paste about five lines above and below the carousel match before changing it. The surrounding variable might be different, so it is safer to confirm the exact line first.
Also keep a note of the file you changed. Shopify can carry non-conflicting code edits into a theme update, but conflicting edits might need to be reapplied.