App reviews, troubleshooting, and recommendations
I can get metafield data through the restadmin API,The returned results are as follows:
But I can't get metafield data through storefront API:
$query = <<<QUERY
query {
customer(customerAccessToken: "$token") {
id
createdAt
metafield(namespace: "custom", key: "avtar"){
value
}
firstName
lastName
acceptsMarketing
phone
}
}
QUERY;
$resp = $clientFront->query(["query" => $query])->getDecodedBody();
The resulting metafield result is null:
["data"] => array(1) { ["customer"] => array(8) { ["id"] => string(48) "Z2lkOi8vc2hvcGlmeS9DdXN0b21lci82MzI1NTI3NjQyMzY4" ["createdAt"] => string(20) "2022-09-02T02:39:38Z" ["metafield"] => NULL ["firstName"] => string(7) "Chunhui" ["lastName"] => string(3) "Ren" ["acceptsMarketing"] => bool(false) ["email"] => string(24) "renchunhui2008@gmail.com" ["phone"] => NULL } }
Solved! Go to the solution
This is an accepted solution.
This is an accepted solution.
Shopify and our financial partners regularly review and update verification requiremen...
By Jacqui Mar 14, 2025Unlock the potential of marketing on your business growth with Shopify Academy's late...
By Shopify Mar 12, 2025Learn how to increase conversion rates in every stage of the customer journey by enroll...
By Shopify Mar 5, 2025