Open charlesLoder opened 4 months ago
Following up. Any thoughts?
Yes, it looks like our description is a little misleading. You are only able to retrieve the customer details if the customer is logged with a customer account, or they are in a Shop Pay checkout (where UI extensions also run). We'll look to update that.
Regarding your use case, you might want to consider using fetch
from the UI extension to an app backend which would then take the email address and query the Admin API to find a corresponding customer (and their tags).
@jamesvidler
Thanks for the reply. We don't have a full backend (extensions only), so fetch won't be possible.
If I'm inferring correctly that "known customer" = using Shop Pay, then some updates to the documentation would be much appreciated.
Please list the package(s) involved in the issue, and include the version you are using
Describe the bug
See more context in forums
According to the documentation for the useCustomer hook, it:
which indicates that there are two conditions in which the hook may return a customer — when they are "known" or "logged in". The second condition is clear, but the first is not.
Steps to reproduce the behavior:
See minimal example:
Expected behavior
I expected when the email field is updated (i.e. a "known customer"), that the customer/buyer identity would as well, similar to a purchase validation function:
Additional context
fetch
won't work here