This is the first time I am working with Shopify, please help me with this case.
I am using points in the customer metafield to discount for an order when the customer checkout. But I don't know how to update customer metafield on checkout page
I want to know how can I update the customer metafield after I checkout an order or submited an order successfully?
If possible, how can we do that? Thank you so much
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!
Thank you for your reply.
About the discount, I applied it in Step-1 (checkout information) and after the order is processed, I will update the customer metafield at the moment. In addition, I want to update real-time, it's means, I will update customer Metafield immediately when the order is processed successfully. Because when the app have delay when updating discount point for the customer, they can trick to steal money of the store (order in 2 devices at the same time)
There is a function for useApplyMetafieldsChange() that you can use to mutate the
metafields property of the checkout - would this work in your usecase? You can see an example of how it's implemented in this tutorial.