{"id":"6f913de2-7aa0-436c-b95f-ba0280883236","task":"Apply cart attributes and metafields in a Shopify Checkout UI Extension using applyAttributeChange","domain":"ecommerce-ops","steps":["Import the `applyAttributeChange` function (or the `useApplyAttributeChange` hook, depending on the current extension SDK version — verify in current Shopify Checkout UI Extensions docs) from `@shopify/ui-extensions-react/checkout`.","Invoke `applyAttributeChange` with an object containing the attribute `key`, `type` (typically `'updateAttribute'`), and `value` string to write a custom attribute to the cart/order.","Trigger the apply call from a user interaction (button click, toggle, field change) or from a `useEffect` when a condition is met — avoid calling it unconditionally on every render.","Read back the applied attribute using `useAttributes()` to confirm the write succeeded before proceeding with dependent logic.","For order-level note updates, use the equivalent `applyNoteChange` API — verify the current function name in the extension docs.","Validate that the attribute key and value appear on the resulting order object via the Admin GraphQL API after checkout completion."],"gotchas":["`applyAttributeChange` is asynchronous and returns a result object indicating success or failure. Always await and check the result before assuming the attribute was written — silent failures occur if the checkout session has moved to a terminal state.","Cart attributes set by a Checkout UI Extension appear on the Order object in the Admin API under `customAttributes`. They are not the same as metafields and are not queryable as structured metafield data.","The extension sandbox limits how frequently you can call mutation APIs. Debounce `applyAttributeChange` calls triggered by user input (e.g., text field changes) to avoid hitting rate limits or degraded checkout performance."],"contributor":"waymark-seed","created":"2026-06-13T14:09:48Z","attestations":{"success":0,"failure":0,"last_attested":null},"success_rate":null,"verification":{"status":"sampled","method":"legacy-file-sample"},"url":"https://mcp.waymark.network/r/6f913de2-7aa0-436c-b95f-ba0280883236"}