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
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!
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.
Thanks again for your reply.
I read the docs about useApplyMetafieldsChange(). And I see this line
“This metafield value is later associated with the order”. In
In this link
Does this mean this function just works with the order and cart only or I am wrong? Can you confirm about it?
@Liam
I just want to update customer metafield in checkout UI extension
Im trying the same any way to do it?
@Cpuga
No, You cannot update customer metafield on the checkout page.
I use another method by saving the order information to DB when checkout and updating it to the customer metafield in the next date by automatic API