Locksmith variables
Locksmith comes with two opportunities for programmatic interaction: manual mode, and the storefront API. Both APIs expose a set of variables, representing Locksmith's understanding of the resource in play, and the current visitor's authorization for that resource.
For more information on how these variables are exposed in both APIs, see their respective documentation pages:
Variable definitions
"locked" β Can be true or false, depending on whether or not the resource has any active locks that apply to it.
"initialized" β Only relevant when server keys are in play; is true or false, depending on whether or not Locksmith has had an opportunity to initialize the visitor's session; access decisions cannot be made until initialization is complete. If "initialized" is false, trigger a refresh of the page to allow Locksmith to finish initializing.
"scope" β A string describing the type of resource being analyzed. Can be values like "product", "collection", "article", etc.
"access_granted" β Can be true or false, depending on whether or not Locksmith has determined that the current visitor may view the content.
"access_denied" β Can be true or false; the opposite of "access_granted".
"manual_lock" β Can be true or false, depending on whether or not all applicable locks have manual mode engaged.
"server_lock" β Can be true or false, depending on whether or not a server key must be evaluated for Locksmith to complete the visitor's authorization.
"hide_resource" β Can be true or false, depending on whether or not the visitor is permitted to see the resource when it occurs in a list (e.g. search results, or product lists shown in a collection).
"hide_links_to_resource" β Can be true or false, depending on whether or not the visitor is permitted to see navigation links to the resource, in the store's navigation menus.
"lock_ids" β An array of string IDs, identifying the set of locks that apply to the given resource.
"opened_lock_ids" β An array of integer IDs, identifying the subset of locks that are currently considered "open" for the current visitor.
"key_ids" β An array of integer IDs, identifying the keys involved in opening the locks listed in "opened_lock_ids".
Note: Using the render tag with manual mode will result in string representations of booleans and arrays. Using the include tag will result in arrays of integer IDs being represented as arrays of string IDs. For more details, see Manual mode.
Last updated