What Is This?
This is a custom list of text fields that enables you to add custom featured stats to your collections in the form of bar graphs.
How Do I Set This Up?
Create the Metafield
- From your Shopify admin, go to Settings > Custom data.
- Select Products.
- Click Add definition.
- In the Name field, enter "Featured Stats". The Namespace and key field will automatically generate as "custom.featured_stats", don't edit this.
- Optional: In the Description field, enter a description for your metafield values. We suggest "For each stat, enter the label, then the percentage between 0% and 100%"
- Click Select content type, and then select Single Line Text.
- Select Accept list of values.
- Enter "1" for the validation information for Minimum character count.
- Click Save.
Shopify provides details about creating metafields here
Supply Data for the Metafield
- From your Shopify admin, go to Products > Collections
- For every collection, select it and scroll to the bottom of the page where you will see the metafield you added in the first set of instructions. Select that field and enter a label for your stat. Click "Add Item", then enter a percentage between 0% and 100% for the stat label you just entered. Repeat until you've entered all the stats you want to that collection.
-
Note: Each stat requires two fields, one for its label and one for the percentage. Do not enter the label and the percentage within the same field
Display the Metafield Data on your Site
There are two sections that enable you to display these featured stats: Collection Teaser and Main List Collections. Follow the instructions for each below.
-
- This section has a setting labeled "Display featured stats", toggle it on
- Optionally, choose the color of the stats
- If you've followed all of the instruction sets above, and you've supplied data for the collection you've chosen for this section and are currently previewing, then you will see your Featured Stats display
-
- This section has a setting labeled "Display featured stats", toggle it on
- Optionally, choose the color of the stats
- If you've followed all of the instruction sets above, and you've supplied data for the collection you're currently previewing, then you will see your Featured Stats display
Comments
0 comments
Please sign in to leave a comment.