Shopify-api-节点中的input.customer是什么?
What is input.customer in Shopify-api-node?
我正在使用MONEI/Shopify-api-node for creating app in Shopify. I have gone through there test cases for creating Customer Shopify-api-node/test/customer.test.jsI just want Format Param for creating customer.When user sign up with email and contact number, I want customer to be created with email and number at my store admin.I just want format param like Format of params for webhook.create
如果有人创建过客户,请在此处删除所需的参数。
另外请检查我的代码是否是创建客户的正确方法,谢谢。
const createCustomer = function(shopDomain, accessToken, customer) {
const shopName=shopDomain.replace('.myshopify.com','');
const shopify = new ShopifyAPIClient({ shopName: shopName, accessToken: accessToken });
shopify.customer.create(customer).then(
response => console.log(`customer ${customer.url} created`),
err => console.log(`Error creating customer ${customer.url} ${JSON.stringify(err.response.body)}`)
);
}
函数调用
afterAuth(request, response) {
const { session: { accessToken, shop } } = request;
createCustomer(shop,accessToken,{
topic: 'admin/customers',
address: `${SHOPIFY_APP_HOST}/admin/customers`,
});
return response.redirect('/');
}
我正在使用MONEI/Shopify-api-node for creating app in Shopify. I have gone through there test cases for creating Customer Shopify-api-node/test/customer.test.jsI just want Format Param for creating customer.When user sign up with email and contact number, I want customer to be created with email and number at my store admin.I just want format param like Format of params for webhook.create
如果有人创建过客户,请在此处删除所需的参数。 另外请检查我的代码是否是创建客户的正确方法,谢谢。
const createCustomer = function(shopDomain, accessToken, customer) {
const shopName=shopDomain.replace('.myshopify.com','');
const shopify = new ShopifyAPIClient({ shopName: shopName, accessToken: accessToken });
shopify.customer.create(customer).then(
response => console.log(`customer ${customer.url} created`),
err => console.log(`Error creating customer ${customer.url} ${JSON.stringify(err.response.body)}`)
);
}
函数调用
afterAuth(request, response) {
const { session: { accessToken, shop } } = request;
createCustomer(shop,accessToken,{
topic: 'admin/customers',
address: `${SHOPIFY_APP_HOST}/admin/customers`,
});
return response.redirect('/');
}