I want to know when the orders_count & total_spent fields of Customer object show real values. When I fetch my orders I mostly get values as 0, 0.0 for orders_count & total_spent fields respectively, for orders placed by new customers, even though the orders are not cancelled.
When I try to fetch this values again later by fetching the Customer object I do get correct values.
Do you update the values after some intervals in batches? OR Do they show up correctly after some particular Order status.
What is the way to correct this?
Kindly let me know as its breaking the logic that is based on these values.
Orders and customers are created independently and associated with one another in the background. This means there will be a delay between orders being created in these values being updated. Your best bet is to listen for order/updated webhooks and when the customer is present in the webhook the values should all be set.