Ad

Shopify - Get Product Title In Liquid?

- 1 answer

In the theme settings the end user is able to select a product from a drop down list of all products. This is done in the settings_scheme.json file.

[
 {
   {
    "name": "Home page - Feature Box 2 (Product 1)",
    "settings": [
   {
    "type": "product",
    "id": "homepage-grid-product-1"
   }
  ]
 }
]

Then using liquid I want to display the name of the product.

On my page I am using the liquid code:

{{ settings.homepage-grid-product-1 }}

This seems to display the SEO url of the product, how can I make the product title display?

I'm sure this is really straightforward, I am still learning and not quite sure what to look up so not been able to find an answer online.

Cheers, DB.

Ad

Answer

You can always do a handle lookup via the all_products object.

all_products[settings.my-product-handle]

Ad
source: stackoverflow.com
Ad