Customer
+ Inheritance diagram for Customer:

Description

Public Properties

const DIR = 'customers'
 
const IS_DECLINED = 'declined'
 Customer declined the invite, has no account. More...
 
const IS_DISABLED = 'disabled'
 Customer can't log in. More...
 
const IS_ENABLED = 'enabled'
 Customer can log in and shop. More...
 
const IS_INVITED = 'invited'
 Customer needs to activate their account via invite link before logging in. More...
 
const MAP
 
const TYPE = 'customer'
 
- Public Properties inherited from AbstractEntity
const DIR = ''
 All subclasses must redeclare this to match their REST directory (without container). More...
 
const TYPE = ''
 All subclasses must redeclare this to match their types. More...
 
- Public Properties inherited from Data
const MAP = []
 
const PATCH = []
 

Protected Properties

string $activationUrl
 
- Protected Properties inherited from Data
Api $api
 
Pool $pool
 

Public Methods

magic bool getAcceptsMarketing ()
 
magic string getAcceptsMarketingUpdatedAt ()
 
string getActivationUrl ()
 
magic Address[] getAddresses ()
 
magic string getCreatedAt ()
 ISO8601. More...
 
magic string getCurrency ()
 read-only More...
 
null Address getDefaultAddress ()
 
magic string getEmail ()
 
magic string getFirstName ()
 
magic string getLastName ()
 
magic string getLastOrderId ()
 read-only More...
 
magic string getLastOrderName ()
 read-only More...
 
magic string getMarketingOptInLevel ()
 read-only More...
 
magic null string getMultipassIdentifier ()
 
magic string getNote ()
 
Order[] getOrders ()
 
magic int getOrdersCount ()
 read-only More...
 
magic string getPhone ()
 
string[] getPoolKeys ()
 
magic string getTags ()
 
magic string[] getTaxExemptions ()
 
magic string getTotalSpent ()
 
magic string getUpdatedAt ()
 
magic bool hasAddresses ()
 
magic bool hasPhone ()
 
magic bool hasTaxExemptions ()
 
bool isDeclined ()
 
bool isDisabled ()
 
bool isEnabled ()
 
bool isInvited ()
 
magic bool isTaxExempt ()
 
magic bool isVerifiedEmail ()
 
Address newAddress ()
 
Invite newInvite ()
 Creates an invite for an existing customer. More...
 
magic Address[] selectAddresses (callable $filter)
 fn( Address $address ): bool More...
 
magic $this setAcceptsMarketing (bool $opted)
 
magic $this setAcceptsMarketingUpdatedAt (string $iso8601)
 
magic $this setAddresses (Address[] $addresses)
 
magic $this setEmail (string $email)
 required, unique More...
 
magic $this setFirstName (string $name)
 required More...
 
magic $this setLastName (string $name)
 required More...
 
magic $this setMultipassIdentifier (?string $ident)
 
magic $this setNote (string $note)
 
$this setPassword (string $password)
 
magic $this setPhone (string $e164)
 unique More...
 
magic $this setSendEmailInvite (bool $invite)
 
magic $this setSendEmailWelcome (bool $welcome)
 
magic $this setState (string $status)
 
magic $this setTags (string $csv)
 
magic $this setTaxExempt (bool $exempt)
 
- Public Methods inherited from AbstractEntity
string __toString ()
 
null string getId ()
 
bool hasId ()
 
$this reload ()
 Fully reloads the entity from Shopify. More...
 
- Public Methods inherited from Data
mixed __call (string $method, array $args)
 
 __construct ($caller, array $data=[])
 
string serialize ()
 Dehydrated JSON encode. More...
 
array toArray ()
 
void unserialize ($serialized)
 
- Public Methods inherited from CreateTrait
$this create ()
 
- Public Methods inherited from DeleteTrait
void delete ()
 
- Public Methods inherited from UpdateTrait
$this update ()
 
- Public Methods inherited from MetafieldTrait
Metafield[] getMetafields ()
 
Metafield newMetafield ()
 Factory. More...
 

Protected Methods

 _setData (array $data)
 Clears all diffs and sets all data, hydrating mapped fields. More...
 
- Protected Methods inherited from AbstractEntity
null AbstractEntity _container ()
 The container/owner object, if any. More...
 
mixed _get (string $field)
 Lazy-loads missing fields. More...
 
void _onDelete ()
 
void _onSave ()
 
void _reload (string $field)
 
- Protected Methods inherited from Data
mixed _hydrate (string $class, $item)
 A factory that also hydrates / caches entities. More...
 
array _select ($subject, callable $filter,... $args)
 Magic method: selectField(callable $filter) More...
 
$this _setField (string $field, $value)
 Sets a value, hydrating if mapped, and clears the diff. More...
 
- Protected Methods inherited from CreateTrait
string _dir ()
 The POST directory. More...
 
- Protected Methods inherited from MetafieldTrait
string _metafieldType ()
 

Additional Inherited Members

- Public Static Methods inherited from AbstractEntity
static null self load ($caller, string $id, array $query=[])
 
static self[] loadAll ($caller, string $path, array $query=[])
 

Properties

◆ IS_DECLINED

const IS_DECLINED = 'declined'

Customer declined the invite, has no account.

◆ IS_DISABLED

const IS_DISABLED = 'disabled'

Customer can't log in.

This is the default.

◆ IS_ENABLED

const IS_ENABLED = 'enabled'

Customer can log in and shop.

◆ IS_INVITED

const IS_INVITED = 'invited'

Customer needs to activate their account via invite link before logging in.

◆ MAP

const MAP
Initial value:
= [
'addresses' => [Address::class],
]

Methods

◆ _setData()

_setData ( array  $data)
protected

Clears all diffs and sets all data, hydrating mapped fields.

Parameters
array$data
Returns
$this

Reimplemented from Data.

◆ getAcceptsMarketing()

magic bool getAcceptsMarketing ( )
Returns
bool

◆ getAcceptsMarketingUpdatedAt()

magic string getAcceptsMarketingUpdatedAt ( )
Returns
string

◆ getActivationUrl()

string getActivationUrl ( )
Returns
string

◆ getAddresses()

magic Address [] getAddresses ( )
Returns
Address[]

◆ getCreatedAt()

magic string getCreatedAt ( )

ISO8601.

Returns
string

◆ getCurrency()

magic string getCurrency ( )

read-only

Returns
string

◆ getDefaultAddress()

null Address getDefaultAddress ( )
Returns
null|Address

◆ getEmail()

magic string getEmail ( )
Returns
string

◆ getFirstName()

magic string getFirstName ( )
Returns
string

◆ getLastName()

magic string getLastName ( )
Returns
string

◆ getLastOrderId()

magic string getLastOrderId ( )

read-only

Returns
string

◆ getLastOrderName()

magic string getLastOrderName ( )

read-only

Returns
string

◆ getMarketingOptInLevel()

magic string getMarketingOptInLevel ( )

read-only

Returns
string

◆ getMultipassIdentifier()

magic null string getMultipassIdentifier ( )
Returns
null|string

◆ getNote()

magic string getNote ( )
Returns
string

◆ getOrders()

Order [] getOrders ( )
Returns
Order[]

◆ getOrdersCount()

magic int getOrdersCount ( )

read-only

Returns
int

◆ getPhone()

magic string getPhone ( )
Returns
string

◆ getPoolKeys()

string [] getPoolKeys ( )
Returns
string[]

Reimplemented from AbstractEntity.

◆ getTags()

magic string getTags ( )
Returns
string

◆ getTaxExemptions()

magic string [] getTaxExemptions ( )
Depends:
canada-only
Returns
string[]

◆ getTotalSpent()

magic string getTotalSpent ( )
Returns
string

◆ getUpdatedAt()

magic string getUpdatedAt ( )
Returns
string

◆ hasAddresses()

magic bool hasAddresses ( )
Returns
bool

◆ hasPhone()

magic bool hasPhone ( )
Returns
bool

◆ hasTaxExemptions()

magic bool hasTaxExemptions ( )
Depends:
canada-only
Returns
bool

◆ isDeclined()

bool isDeclined ( )
final
Returns
bool

◆ isDisabled()

bool isDisabled ( )
final
Returns
bool

◆ isEnabled()

bool isEnabled ( )
final
Returns
bool

◆ isInvited()

bool isInvited ( )
final
Returns
bool

◆ isTaxExempt()

magic bool isTaxExempt ( )
Returns
bool

◆ isVerifiedEmail()

magic bool isVerifiedEmail ( )
Returns
bool

◆ newAddress()

Address newAddress ( )
Returns
Address

◆ newInvite()

Invite newInvite ( )

Creates an invite for an existing customer.

Returns
Invite

◆ selectAddresses()

magic Address [] selectAddresses ( callable  $filter)

fn( Address $address ): bool

Returns
Address[]

◆ setAcceptsMarketing()

magic $this setAcceptsMarketing ( bool  $opted)
Returns
$this

◆ setAcceptsMarketingUpdatedAt()

magic $this setAcceptsMarketingUpdatedAt ( string  $iso8601)
Returns
$this

◆ setAddresses()

magic $this setAddresses ( Address[]  $addresses)
Depends:
create-only, bulk
Returns
$this

◆ setEmail()

magic $this setEmail ( string  $email)

required, unique

Returns
$this

◆ setFirstName()

magic $this setFirstName ( string  $name)

required

Returns
$this

◆ setLastName()

magic $this setLastName ( string  $name)

required

Returns
$this

◆ setMultipassIdentifier()

magic $this setMultipassIdentifier ( ?string  $ident)
Returns
$this

◆ setNote()

magic $this setNote ( string  $note)
Returns
$this

◆ setPassword()

$this setPassword ( string  $password)
Parameters
string$password
Returns
$this

◆ setPhone()

magic $this setPhone ( string  $e164)

unique

Returns
$this

◆ setSendEmailInvite()

magic $this setSendEmailInvite ( bool  $invite)
Depends:
create-only
Returns
$this

◆ setSendEmailWelcome()

magic $this setSendEmailWelcome ( bool  $welcome)
Depends:
create-only
Returns
$this

◆ setState()

magic $this setState ( string  $status)
Depends:
create-only, see the constants
Returns
$this

◆ setTags()

magic $this setTags ( string  $csv)
Returns
$this

◆ setTaxExempt()

magic $this setTaxExempt ( bool  $exempt)
Returns
$this