How to Set Different Product Titles Between Collections Page and Individual Product Pages?

Solved
IlluminateLabs
Excursionist
101 0 10

We have an All Products page that I want to shorten the product titles on. I want the titles to remain the same on the individual product pages. 

How can I do this?

0 Likes
Alan15
Pathfinder
93 21 25

If you just want to cut the product titles to a certain number of characters you can use a filter on your product title field.

Something like this {{ product.title | truncate: 20 }}

This will shorten the product title to 20 characters. It will depend on your theme as to where the code is located.

0 Likes
IlluminateLabs
Excursionist
101 0 10

@Alan15 Hi Alan, thank you for your response. I don't want a simple truncation, but rather an elimination of two words for each SKU and a re-alignment.

Currently a product title looks like: "Gingko Biloba Extract Capsules - 240 mg"

This is fine for the individual product page but too wordy and repetitive on all products page.

I want to change it to:

Ginkgo Biloba

240 mg

Two lines, with the text centered. Same format for each of the four products.

Unsure how to do so and I haven't seen any other threads on this topic.

0 Likes
Alan15
Pathfinder
93 21 25

How about adding a shortened product name metafield to each product and display that on the product list page and keep the full product name on the individual product page?

0 Likes
IlluminateLabs
Excursionist
101 0 10

@Alan15 that sounds like a great idea. I'm unsure of how to execute it. Can I add a metafield directly without having to download an app to facilitate? I try to avoid excess apps.

Is there a guide or tutorial for this sort of thing? Thanks for your advice btw.

0 Likes
Alan15
Pathfinder
93 21 25

This is an accepted solution.

It is possible to add metafields without an app (the Metafields Guru app works well if you want to use one).

Without an app enter this url in your browser:

https://your-store name.myshopify.com/admin/bulk?resource_name=Product&edit=metafields.global.short-name,metafields.global.product-weight


This should add 2 metafields to your products; one called short-name and one called product-weight ( give them whatever name you want).

Go to your list of all products in the Dashboard Admin. Select the products you want to update. Select the Edit products button. You should see your metafields there and you can give them the required values.

Then you can access those values in your liquid code using {{product.metafields.global.short-name}} and {{product.metafields.global.product-weight}}

Maybe one metafield is enough for what you want, with 2 maybe it might be easier to get the layout you want.

Here is Shopify's explanation of the Metafields object:
https://shopify.dev/docs/themes/liquid/reference/objects/metafield