How to add a metafield to the Chart block
Use a product metafield to drive Vincent's Chart block, so rating values live on the product instead of being set by hand in every template.
If you are looking to streamline the process of adding multiple chart blocks to your product pages, using metafields can save time by centralising product-specific values.
For general guidance on creating and managing metafields in Shopify, refer to the official Shopify documentation.
Why use metafields for the Chart block?
On product pages, adding multiple chart blocks manually can be time-consuming. By linking product-specific values to metafields, you can reduce repetitive work and manage data more efficiently.
Step 1: Add a metafield definition for the Chart block
- From your Shopify admin, navigate to Settings > Custom data > Products.
- Click Add definition to create a new metafield definition.
- Enter a name for the metafield (for example "Chart value") and set the type to Integer.
- Under Validation, set the minimum value to 1 and the maximum value to 5.
- Click Save.

Step 2: Link the metafield to a product
- In your Shopify admin, go to Products and select the product you want to update.
- Scroll down to the Metafields section.
- Enter a value between 1 and 5 in the field for the newly created metafield.
- Click Save.

Step 3: Connect the metafield to the product template
- From your Shopify admin, go to Online Store > Themes.
- Select the Vincent theme and open the Products template.
- In the Chart block under the Product information section, click the Connect dynamic source button next to Rating (Metafield).
- Select the newly created chart metafield. Make sure the product has a metafield value set so the change is visible.
- Click Save.

Testing your setup
Once all three steps are complete, test your product page to ensure the chart blocks display as expected. Below is an example of a properly configured chart block:

Notes
- Ensure each product has a valid metafield value set to reflect the changes on the product page.
- Metafields offer flexibility and reduce manual effort, especially when dealing with repetitive data across multiple products.
