Ad

What Is Input.customer In Shopify-api-node?

- 1 answer

I am using 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

If anyone has ever created customer please drop the required param here. Also please check my code whether is it correct way to create customer or not thanks.

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)}`)
);

}

function call

afterAuth(request, response) {
    const { session: { accessToken, shop } } = request;

      createCustomer(shop,accessToken,{
        topic: 'admin/customers',
        address: `${SHOPIFY_APP_HOST}/admin/customers`,
      });

    return response.redirect('/');
  }
Ad

Answer

Ad
source: stackoverflow.com
Ad