Skip to content

How to Set Custom Impact per Variant

With GoodAPI, you can dynamically adjust the impact of your products based on the selected variant. For example, a single lip balm could plant 1 tree and remove 10 plastic bottles, while a pack of three could plant 3 trees and remove 30 bottles. This guide will show you how to configure custom impact per variant in Shopify.

Dynamic Variant Impact

Step 1: Create Variant Metafield Definitions

Section titled “Step 1: Create Variant Metafield Definitions”
  1. In your Shopify admin, go to SettingsCustom dataVariants.
  2. Click Add definition and create two metafields:
  • Trees
  • Name: goodapi_num_trees
  • Type: Integer
  • Plastics
  • Name: goodapi_num_plastics
  • Type: Integer
  1. Click Save after creating each definition. These metafields will allow you to assign specific impact values to each variant.
  1. Go to Products in your Shopify admin.
  2. Open the product you want to configure.
  3. Scroll down to the Variants section and click into a variant.
  4. You’ll now see the new metafield fields:
  • goodapi_num_trees
  • goodapi_num_plastics
  1. Enter the values for each variant. For example:
  • Small → 1 tree, 1 plastic
  • Medium → 2 trees, 2 plastics
  • Large → 3 trees, 3 plastics
  1. Repeat for each variant, then click Save.

Once saved, your product’s variants will automatically update the impact values depending on which one is sold. For example:

  • Selecting Small → shows 1 tree + 1 plastic bottle
  • Selecting Medium → shows 2 trees + 2 plastic bottles
  • Selecting Large → shows 3 trees + 3 plastic bottles Refresh your storefront preview if the values don’t appear immediately.

That’s it! You’ve now enabled dynamic impact per variant. Customers will see the correct impact displayed based on their chosen product size or type, ensuring your sustainability efforts are transparent and accurate.