# Customer account keys

Many of Locksmith's key conditions use the customer account system that comes by default with all Shopify stores to check for specific customer attributes before granting access. These are detailed below.

{% hint style="info" %}
**Note**: Locksmith does **not** create a separate account system or customer database! In order to use customer accounts with Locksmith, you'll first need to [make sure that customer accounts are activated in your store](https://help.shopify.com/en/manual/customers/customer-accounts#set-your-customer-account-preferences).
{% endhint %}

When these key conditions are used, **Locksmith will ask that a customer signs in first**, whenever a customer tries to access the locked content in your store. Locksmith does so by automatically displaying the login template from your theme:

![](/files/VQwivnx6b2jpZMbm3Baj)

Some of the options available to you include checking **if the customer**...

* **is signed in**\
  This condition requires all customers to log in. Once they're logged in, they'll be granted access to the locked resource.
* **is tagged with…**\
  This condition *first* requires all visitors to log in with a customer account. Once the customer has logged into their account, they'll be granted access *if* their customer account has the tag you've chosen in Locksmith. (When inverted: ***unless*****&#x20;the customer is tagged with..., or is&#x20;*****not*****&#x20;signed in**)
* **has placed at least x orders**\
  This condition requires the visitor to be logged in with their customer account. If their lifetime order count is at least the number that you specify, they'll be granted access.
* **has purchased…**\
  This condition requires the visitor to be logged in with their customer account, prompting them to log in if they aren't already. If their last 50 orders contain a certain product (identified by SKU, title, or by product tag), they'll be granted access.
* **the customer's email contains…**\
  This condition requires the visitor to be logged in with their customer account. If their email address matches some text that you specify (say, "@mycompany.com"), they'll be granted access.
* **has one of many email addresses**\
  This condition requires the visitor to be logged in with their customer account. If their email address is on the list that you specify, they'll be granted access. Simply to set up, but not recommend if you have a large number of email addresses. See below for an alternate option.
* **has an email from an input list**\
  This condition requires the visitor to be logged in with their customer account. If their email address is on the list that you specify, they'll be granted access. This key condition is different than the above, in that it leverages [Locksmith's input list feature](/tutorials/more/input-lists.md), which lets you use a very large number of of email addresses. While not hard to set up, it does require a few more steps than the one-of-many-email-addresses key condition above.

## Creating keys

The guide linked below covers adding a key to a lock and selecting a key condition:

{% content-ref url="/pages/BbEIkISi5XdTtEe4SKt1" %}
[Creating keys](/basics/creating-keys.md)
{% endcontent-ref %}

## Inverting key conditions

Don't forget that all key conditions can be inverted! Which just means that Locksmith will check for *the opposite of* the original condition. More info on that here:

{% content-ref url="/pages/WvgSxoLu5Yu2LN8UhkxS" %}
[Inverting conditions in Locksmith](/keys/more/inverting-conditions-in-locksmith.md)
{% endcontent-ref %}

## Liquid key conditions

If the list above does not include the exact customer attribute that you are wanting to check, you have the flexibility to use [any Liquid attribute that Shopify makes available on the customer object](https://shopify.dev/api/liquid/objects#customer). This is done by using a "custom Liquid" key condition.

Most notably, **this would allow you to use customer metafields** in order to grant access. More complete information on custom liquid key conditions - including setup guide - here:

{% content-ref url="/pages/ve2JX4pz2jetN297ciB6" %}
[Custom Liquid key-condition basics](/keys/more/custom-liquid-key-condition-basics.md)
{% endcontent-ref %}

## More information related to customer accounts

Here are a few more links to guides that you might find useful as you set up Locksmith to work with your customer account system:

{% content-ref url="/pages/JLN0jWFrcYvt6efxhMT0" %}
[Approving customer registrations](/tutorials/approving-customer-registrations.md)
{% endcontent-ref %}

{% content-ref url="/pages/xbxhHadjI7Iip4aWc2rq" %}
[Customizing the customer login page](/tutorials/more/customizing-the-customer-login-page.md)
{% endcontent-ref %}

{% content-ref url="/pages/aGfqo2XVdHpo4Z5mXBsa" %}
[Customizing the registration form](/tutorials/more/customizing-the-registration-form.md)
{% endcontent-ref %}

{% content-ref url="/pages/YN4tss8Ren6LqyAQ78LD" %}
[Customizing messages](/tutorials/more/customizing-messages.md)
{% endcontent-ref %}

As always, please feel free to reach out to us directly via email at **<team@uselocksmith.com>** if you have any questions!


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://www.locksmith.guide/keys/customer-account-keys.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
