---
title: "customer"

doc_type: static
doc_category: static
doc_version: v20270301
source_url:
  html: 'https://developer.shopline.com/docs/sline/object/customer'
  md: 'https://developer.shopline.com/docs/sline/object/customer.md'
---

# customer


    A [customer](https://help.shopline.com/hc/en-001/articles/13669181757849-Managing-Customers) of the store. When a customer is logged into their account, the customer object can be accessed globally. If the customer is not logged in, the object is only defined within the following contexts:

- The template [customers/account](https://developer.shopline.com/docs/online-store-3-0-themes/theme-structure/templates.md#kwgVv)
- The template [customers/addresses](https://developer.shopline.com/docs/online-store-3-0-themes/theme-structure/templates.md#kwgVv)
- The template [customers/order](https://developer.shopline.com/docs/online-store-3-0-themes/theme-structure/templates.md#kwgVv)


Outside of these scenarios, if the customer is not logged in or the corresponding context does not exist, the customer object returns `nil`.

#### Check if the customer object exists
When using the customer object in a template or object where its existence is not certain, it is advisable to first check if the customer object exists.


```js
{{#if customer }}
  Hello, {{ customer.first_name }}!
{{/if}}
```


    



## Properties

    <div>
    

        
<ObjectProperty 
    name="accepts_email_marketing"
    types={[<Mdx>boolean</Mdx>]}
>
<ObjectSummary>
Whether the customer has subscribed to email marketing.
- `true`: Subscribed
- `false`: Not subscribed


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="accepts_sms_marketing"
    types={[<Mdx>boolean</Mdx>]}
>
<ObjectSummary>
Whether the customer has subscribed to SMS marketing.
- `true`: Subscribed
- `false`: Not subscribed


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="addresses"
    types={[<Mdx>array of [address](https://developer.shopline.com/docs/sline/object/address.md)</Mdx>]}
>
<ObjectSummary>
All personal shipping addresses of the customer, limited to a maximum of 50 addresses.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="addresses_count"
    types={[<Mdx>integer</Mdx>]}
>
<ObjectSummary>
The number of personal shipping addresses for the customer.

Value range: 0-50


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="b2b"
    types={[<Mdx>boolean</Mdx>]}
>
<ObjectSummary>
Whether the customer is a B2B customer.
- `true`: A B2B customer
- `false`: Not a B2B customer

To learn about B2B functionality, refer to [B2B Company](https://help.shopline.com/hc/en-001/articles/21925057806745).


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="company_available_locations"
    types={[<Mdx>array of [company_location](https://developer.shopline.com/docs/sline/object/company-location.md)</Mdx>]}
>
<ObjectSummary>
A list of company locations accessible to the customer.

To learn about B2B functionality, refer to [B2B Company](https://help.shopline.com/hc/en-001/articles/21925057806745).


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="current_company"
    types={[<Mdx>[company](https://developer.shopline.com/docs/sline/object/company.md)</Mdx>]}
>
<ObjectSummary>
The company information currently selected by the customer.

To learn about B2B functionality, refer to [B2B Company](https://help.shopline.com/hc/en-001/articles/21925057806745).


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="current_location"
    types={[<Mdx>[company_location](https://developer.shopline.com/docs/sline/object/company-location.md)</Mdx>]}
>
<ObjectSummary>
The company location currently selected by the customer.

To learn about B2B functionality, refer to [B2B Company](https://help.shopline.com/hc/en-001/articles/21925057806745).


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="cancelling_account"
    types={[<Mdx>boolean</Mdx>]}
>
<ObjectSummary>
Whether the customer has applied to delete the account.
- `true`: Applied
- `false`: Not applied


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="cancelling_time"
    types={[<Mdx>string</Mdx>]}
>
<ObjectSummary>
The timestamp when the customer account will be deleted. You can format the time using the [date](https://developer.shopline.com/docs/sline/filter/date.md) filter.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="default_address"
    types={[<Mdx>[address](https://developer.shopline.com/docs/sline/object/address.md)</Mdx>]}
>
<ObjectSummary>
The default personal shipping address of the customer.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="email"
    types={[<Mdx>string</Mdx>]}
>
<ObjectSummary>
The customer's email address. Returns `nil` if the value is not set.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="first_name"
    types={[<Mdx>string</Mdx>]}
>
<ObjectSummary>
The customer's first name.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="last_name"
    types={[<Mdx>string</Mdx>]}
>
<ObjectSummary>
The customer's last name.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="login_sources"
    types={[<Mdx>array of [login_source](https://developer.shopline.com/docs/sline/object/login-source.md)</Mdx>]}
>
<ObjectSummary>
The third-party account information of the customer.



</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="has_account"
    types={[<Mdx>boolean</Mdx>]}
>
<ObjectSummary>
Whether the email address used by the customer during checkout is associated with a [customer account](https://help.shopline.com/hc/en-001/articles/21705361544985-Understanding-the-Customer-Account-Versions).
- `true`: The email address is associated with an existing customer account.
- `false`: The email address is not registered with the store.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="id"
    types={[<Mdx>string</Mdx>]}
>
<ObjectSummary>
The customer's ID.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="name"
    types={[<Mdx>string</Mdx>]}
>
<ObjectSummary>
The customer's full name.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="orders"
    types={[<Mdx>array of [order](https://developer.shopline.com/docs/sline/object/order.md)</Mdx>]}
>
<ObjectSummary>
All orders of the customer.

Displays the 10 most recent orders by default. You can use the [get_pagination](https://developer.shopline.com/docs/sline/filter/get-pagination.md) filter to set the number of orders shown per page.
</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="orders_count"
    types={[<Mdx>integer</Mdx>]}
>
<ObjectSummary>
The total number of orders for the customer.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="phone"
    types={[<Mdx>string</Mdx>]}
>
<ObjectSummary>
The customer's phone number. Returns `nil` if the value is not set.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="phone_dialing_code"
    types={[<Mdx>string</Mdx>]}
>
<ObjectSummary>
The international dialing code for the customer’s phone number.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="tags"
    types={[<Mdx>array of string</Mdx>]}
>
<ObjectSummary>
A list of the customer's tags.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="tax_exempt"
    types={[<Mdx>boolean</Mdx>]}
>
<ObjectSummary>
Whether the customer is tax exempt.
- `true`: Tax-exempt
- `false`: Taxable


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="total_spent"
    types={[<Mdx>float</Mdx>]}
>
<ObjectSummary>
The total amount of all orders for the customer. You can format the amount using the [money](https://developer.shopline.com/docs/sline/filter/money.md) filter.


</ObjectSummary>
</ObjectProperty>
        
<ObjectProperty 
    name="accepts_marketing"
    types={[<Mdx>boolean</Mdx>]}
>
<ObjectSummary>
Whether the customer accepts marketing.
- `true`: Accepted
- `false`: Not accepted


</ObjectSummary>
</ObjectProperty>
        
    
    </div>


