Home Manual Reference Source Repository

Entities/Shop

The Shop entity represents global shop settings and details (i.e. contact email address, policies, URL, etc.)

This entity is read-only, and it properties match that of the Shopify shop liquid object. There are some extra methods and properties added for convinience.

Examples

ES6:

import {entities, utils} from '@eastsideco/escshopify';

const shop = new entities.Shop;

// Accessing shop properties:
var primaryDomain = shop.domain;
var myshopifyDomain = shop.permanent_domain;

var storeName = shop.name;

var defaultCurrency = shop.currency;

var averageCollectionSize = shop.products_count / shop.collections_count;


// Generating absolute shop URLs:
var absoluteUrl = shop.makeAbsoluteUrl('/collections/all'); // https://shop.com/collections/all
var permanentUrl = shop.makePermanentUrl('/collections/all'); // https://shop.myshopify.com/collections/all

Getting Started

Initializing the shop state

Before using the shop module, you should initialize it with the global shop state, for eaxmple from a binding created in Liquid.

This is done for you automatically if you use SALVO.

ES6:

import {entities, utils} from '@eastsideco/escshopify';

const shop = new entities.Shop;

shopData = { name: '...', domain: '...', ... };
shop.initialize(shopData);

Events

Listen to the following events to track the lifecycle of this entity.

init

The shop entity was initialized.

Object  shop        - The current shop entity.