Module: Shopify

Methods

(static) connect(shopNamenon-null, accessTokenopt, nullable, connectionOptionsnullable) → {StoreConnectionInstance}

Create Shopify API instance and filestore it in CACHE.connect

Parameters:
Name Type Attributes Description
shopName string
accessToken object | string <optional>
<nullable>
connectionOptions ShopifyConnectionOptions <nullable>
Source:
Returns:
Type
StoreConnectionInstance

(static) getShopData(shopName, fetchopt) → {Promise.<(ShopifyShop|undefined)>}

Get and Save Shopify Store Information

implements package:shopify-api-node.shop.get()

Parameters:
Name Type Attributes Default Description
shopName string
fetch boolean | number <optional>
false

indicates whether to perform the fetch from Shopify API instead of returning the datastore record

Source:
Returns:

shopData - shop info with added properties of

  • datastore_inserted_at
  • datastore_updated_at
  • shopName - third-level domain name of the shop shopName[.myshopify.com]
  • shopID - Shopify Shop ID
Type
Promise.<(ShopifyShop|undefined)>
Example
Response
{
  id: 55028482214,
  name: 'Zap Moto',
  email: 'sales@zapmoto.com.au',
  domain: 'zapmoto.com.au',
  province: 'Queensland',
  country: 'AU',
  address1: '40 Waterloo Street',
  zip: '4006',
  city: 'Newstead',
  source: 'buildify',
  phone: '0424977731',
  latitude: -27.4481248,
  longitude: 153.0444463,
  primary_locale: 'en',
  address2: '',
  created_at: '2021-03-02T20:16:39+10:00',
  updated_at: '2021-12-08T21:21:17+10:00',
  country_code: 'AU',
  country_name: 'Australia',
  currency: 'AUD',
  customer_email: 'Sales@zapmoto.com.au',
  timezone: '(GMT+10:00) Australia/Brisbane',
  iana_timezone: 'Australia/Brisbane',
  shop_owner: 'Paul Halhead',
  money_format: '${{amount}}',
  money_with_currency_format: '${{amount}} AUD',
  weight_unit: 'kg',
  province_code: 'QLD',
  taxes_included: true,
  auto_configure_tax_inclusivity: false,
  tax_shipping: false,
  county_taxes: true,
  plan_display_name: 'Basic Shopify',
  plan_name: 'basic',
  has_discounts: false,
  has_gift_cards: false,
  myshopify_domain: 'zap-moto.myshopify.com',
  google_apps_domain: null,
  google_apps_login_enabled: null,
  money_in_emails_format: '${{amount}}',
  money_with_currency_in_emails_format: '${{amount}} AUD',
  eligible_for_payments: true,
  requires_extra_payments_agreement: false,
  password_enabled: false,
  has_storefront: true,
  eligible_for_card_reader_giveaway: false,
  finances: true,
  primary_location_id: 61045997734,
  cookie_consent_level: 'implicit',
  visitor_tracking_consent_preference: 'allow_all',
  checkout_api_supported: true,
  multi_location_enabled: true,
  setup_required: false,
  pre_launch_enabled: false,
  enabled_presentment_currencies: [ 'AUD' ],
  force_ssl: true,
  shopName: 'zap-moto',
  shopID: 55028482214
}

(static) getStoredShopData(shopNameOrId, cached) → {Promise.<(undefined|*)>}

Get ShopData from Datastore

Parameters:
Name Type Description
shopNameOrId string | number
cached
Source:
Returns:
Type
Promise.<(undefined|*)>

(static) getStoredToken(shopNameOrId) → {Promise.<{shopNames: Array(), ids: Array(), tokens: Array()}>}

get shopify auth token from the datastore

Parameters:
Name Type Description
shopNameOrId string | number
Source:
Returns:
Type
Promise.<{shopNames: Array(), ids: Array(), tokens: Array()}>

(static) saveShopData(data) → {Promise.<(void|*)>}

Save Shopify shopData to the datastore

Parameters:
Name Type Description
data
Source:
Returns:
Type
Promise.<(void|*)>

Type Definitions

ShopifyConnectionOptions

Type:
  • object
Properties:
Name Type Attributes Default Description
timeout number <optional>
180000

request timeout

autoLimit boolean <optional>
true

limit api requests

stringifyJson function <optional>
stringifyJSON

function used instead of JSON.stringify

presentmentPrices boolean <optional>
true

fetch representment prices

Source: