Ingredient index
Set up the Ingredient index, an A to Z list where each name opens a card with what it does and the products that contain it.
Updated
The Ingredient index lists your ingredients from A to Z, grouped by first letter. Each name opens a card with what the ingredient does, up to four products that contain it, and a link to a page about it if you set one.
Before you start
The section works from the block text alone. To have products appear on the cards, fill these product metafields, created under Settings > Custom data > Products:
custom.key_ingredients: list of single line textcustom.ingredients: multi-line text with the full ingredient list
Details are in Product data. The section uses no metaobjects or tags.
Add the section
- In the theme editor, open the page and select Add section, then choose Ingredient index.
- Set Heading (default "Ingredients, A to Z") and Text.
- Add an Ingredient block for each ingredient.
- On each block, set Ingredient name, What it does and optionally Page about this ingredient.
- Set Space above and below and Color scheme.
Adding it from the section list gives you four examples: Glycerin, Grape seed oil, Niacinamide and Squalane.
Section settings
| Label | What it does |
|---|---|
| Heading | Default "Ingredients, A to Z". |
| Text | Rich text under the heading. |
| Space above and below | None, Small, Medium or Large. Default Small. |
| Color scheme | Default scheme-label. |
Ingredient block settings
| Label | What it does |
|---|---|
| Ingredient name | The name shown, and the text used to find products. Default "Niacinamide". |
| What it does | A few words, for example: holds water in the skin. Default "Evens tone". |
| Page about this ingredient | A page linked from the card as Read more. Leave empty to link to a search. |
How the order and groups work
The section builds one group for each first letter among your block names and sorts the letters. The letter is the first character of the name, so keep names consistent. Order inside a group follows the order of the blocks.
How products are found
For each ingredient, the theme looks through the first 50 products in the store's All collection. It matches the ingredient name, in lowercase, against custom.key_ingredients and custom.ingredients. It shows up to four matches. A percentage in the name, as in "Niacinamide 5%", is dropped before matching, so write the name the way the metafields do.
When a name is plain text
If no product matches and the block has no What it does text and no page, the name appears as plain text instead of a button.
Related
Still stuck? Get theme support