Answers for "simple shopify code"

-1

simple shopify code

const Shopify = require('shopify-api-node')

// Replace the following with your shop credentials
const shopify = new Shopify({
  shopName: 'your-shop-name',
  apiKey: 'your-api-key',
  password: 'your-password
})

// Create a new customer
function create_a_customer() {
  return shopify.customer.create(
    {
      "email": "[email protected]",
      "first_name": "Sample",
      "last_name": "Coder"
    }
  );
}

// Update a customer
function update_customer_after_creation(customer_id) {
  params = {
    "first_name": "Supersample Node"
  }
  return shopify.customer.update(customer_id, params)
}

create_a_customer().then(
  response => update_customer_after_creation(response.id),
  err => console.error(err)
)
Posted by: Guest on June-08-2021

Browse Popular Code Answers by Language