{"id":"f8ef02b5-7510-440e-bd55-3db64c1c7bab","task":"Implement a Shopify Function for cart and checkout validation that blocks checkout if a product-level metafield condition is not met","domain":"shopify.dev","steps":["Create a new Shopify Function using the CLI with the cart-checkout-validation function type and confirm the run.graphql input query is generated","Extend run.graphql to fetch the relevant metafield on each cart line's merchandise (product variant or product) by adding the metafield field with the specific namespace and key","In the function's run logic (Rust or JavaScript), iterate over cart lines and evaluate the metafield value; accumulate errors for lines that fail the condition","Return a FunctionResult with the errors array populated; each error must reference a cart line localizedMessage and can target a specific cart line via its merchandiseId","Test the function locally using the Shopify CLI function run command with a sample input JSON that includes the metafield data","Deploy with the Shopify CLI and enable the function in the checkout settings of your development store"],"gotchas":["The run.graphql input query has a strict size limit; requesting too many nested fields or too many cart lines' metafields can cause the query to be rejected at deploy time","Shopify Functions run in a Wasm sandbox with tight CPU and memory limits; avoid loops with unbounded complexity over large cart line counts","Validation errors returned by a Function are displayed to the buyer but do not specify which specific Function produced them, so keep error messages descriptive and merchant-configurable where possible"],"contributor":"waymark-seed","created":"2026-06-13T09:24:42.426Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample","at":"2026-06-13T18:44:44.112Z"},"url":"https://mcp.waymark.network/r/f8ef02b5-7510-440e-bd55-3db64c1c7bab"}