Rule: Metafield Trigger
You can easily show blocks based on a pre-defined metafield that Checkout Blocks supports using the following metafield configuration as a metafield definition:
Namespace
checkoutblocks
Key
trigger
Type
Single line text
Supported resources
Company, Customer, Product
It's important that these metafields get created as a definition. Also, make sure to expose the metafield definition to the storefront:
![Image](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F6uh16tjz%2Fproduction%2F509930eb2a762e0fa3b649a09a4db3c522316b42-1474x450.png%3Ffit%3Dmax%26auto%3Dformat&w=3840&q=75)
Then simply select the associated metafield rule on a particular block:
![associate to particular block](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F6uh16tjz%2Fproduction%2F5a1584cc7acec816071d61919a276d59696643ac-1246x952.png%3Ffit%3Dmax%26auto%3Dformat&w=3840&q=75)
Product metafield trigger
![metafield trigger](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F6uh16tjz%2Fproduction%2F85ad5e94cecaa92c6a90587382d5971b4ce2abb2-1788x612.png%3Ffit%3Dmax%26auto%3Dformat&w=3840&q=75)
How to trigger a block based on product metafield
You can easily trigger a checkout block based on a product metafield. The one caveat is that at this time, the metafield must be using the namespace: checkoutblocks and the key: trigger.
- First, navigate to a product within your Shopify admin. At the bottom of the page you will see a metafield section with the "Checkout Blocks Rule Trigger" pinned.
![Step 1](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F6uh16tjz%2Fproduction%2Fc58816f2d2204d0fbb55b149985d25edd1517f5e-1314x492.png%3Ffit%3Dmax%26auto%3Dformat&w=3840&q=75)
- Add a value:
![step 2](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F6uh16tjz%2Fproduction%2F73ff3fb9be7245da53ba8363c27dc07ce4b97c86-1360x466.png%3Ffit%3Dmax%26auto%3Dformat&w=3840&q=75)
- Add the "Product metafield" rule to a checkout block with the same value:
![step 3](/_next/image?url=https%3A%2F%2Fcdn.sanity.io%2Fimages%2F6uh16tjz%2Fproduction%2F38ed880f8354e6b46b17ad1e906f755b888b2bbe-1868x762.png%3Ffit%3Dmax%26auto%3Dformat&w=3840&q=75)