UNPKG

shopifymo

Version:

- Module get product information, customer, order history. - Get customer information by token and authenticate through email login, password

34 lines (26 loc) 1.02 kB
import { LATEST_API_VERSION } from "@shopify/shopify-api"; import ShopifyMo from ".."; let main = async () => { let shopifyMo = new ShopifyMo({ domain: 'storename.myshopify.com', apiKey: 'xxx', apiSecretKey: 'xxx', adminApiAccessToken: 'xxx', storefrontAccessToken: 'xxx', scopes: ['read_products'], hostName: 'localhost:3000', apiVersion: LATEST_API_VERSION, isEmbeddedApp: true }) let customer = await shopifyMo.adminRestApi.findCustomer(6941610115353) let ordersHistory: any = await shopifyMo.adminRestApi.findOrderOnCustomer (6941610115353, 'any'); // let productAll = await shopifyMo.storefrontApi.getProductAll() // let product = await shopifyMo.storefrontApi.getProduct(8214622208281) // let customerAccessToken: any = await shopifyMo.storefrontApi.customerAccessTokenCreate({ // email: 'xxx@gmail.com', // password: '123456' // }) // let customer = await shopifyMo.storefrontApi.getCustomer( { customerAccessToken } ) console.log(customer, ordersHistory); } main()