首先,我有一个自定义的 Shopify 前端,当前正在使用管理 API 来加载产品。我也使用 apollo/graphql 后端与 Shopify 管理 API 进行通信。我正在使用 shopify-api-node 来促进管理 API 查询。我最近发现 shopify-api-node 包不支持与店面 API 的通信。我想使用店面 API 的原因是因为我想在前端制作表单,允许用户为我的商店创建帐户。我会使用管理 API,但由于某种原因,管理 API 无法创建带有密码的帐户。
根据 Shopifys 文档,您必须使用店面 API 才能完成我想要的任务。我已经尝试了几天不同的事情,但也没有成功。不幸的是,关于这方面的文档并不多,Shopifys 文档可能会成为一个兔子洞。任何建议都会很棒。因此,我需要帮助找出连接到店面 api 的最佳方法,这样我就可以使用 customerCreate 并在创建中包含密码。
我想你可以直接使用店面graphQL突变API
customerCreate
/*
CustomerCreateInput
{
"input": {
"acceptsMarketing": true,
"email": "",
"firstName": "",
"lastName": "",
"password": "",
"phone": ""
}
}
*/
mutation customerCreate($input: CustomerCreateInput!) {
customerCreate(input: $input) {
customer {
# Customer fields
}
customerUserErrors {
# CustomerUserError fields
}
}
}
您可以使用
传递用户名和密码CustomerCreateInput
参考:https://shopify.dev/docs/api/storefront/2023-07/mutations/customerCreate
如有疑问请评论