How can update Customer Metafield when checkout successfully

Topic summary

Goal: deduct a customer’s points (stored in a customer metafield—custom data attached to a resource) immediately upon a successful checkout to prevent double-spending (e.g., two devices ordering simultaneously).

Flow described: discount applied at the first checkout step. The need is to update the customer metafield in real time once the order is processed.

Proposed approach reviewed: useApplyMetafieldsChange in a Checkout UI extension can mutate checkout metafields (data tied to the checkout/order), not customer metafields. This means it won’t update the customer’s stored points directly at checkout.

Current limitation: updating customer metafields from within Checkout UI extensions isn’t supported/confirmed possible in this thread.

Workaround adopted: save order details to an external database at checkout, then update the customer metafield later via an automated API process (not real-time, e.g., next day).

Status: No built-in real-time method confirmed for updating customer metafields during/at checkout. Thread concludes with a deferred update workaround; the real-time fraud-prevention need remains unresolved in-thread.

Summarized with AI on January 11. AI used: gpt-5.

Hi Nhtbao101,

Just to understand your use-case fully - do you want to update the customer metafield during the checkout process, or after - ie: once the order is processed? When do you want the discount to be applied?

Once I have a little bit more info I can recommend the best approach!