New to manual locking? Check out our general introduction.

By default, Locksmith will protect all of the content under a given lock. Sometimes that might be too aggressive - you might want to allow visitors to preview your products without being able to see pricing, or without being able to make a purchase.

Locksmith comes with an advanced manual mode that allows for this sort of thing - it disables Locksmith's full-page protection, stepping aside so that some custom code in your theme can take responsibility for hiding part of your content.

Because each theme is a bit different, this feature does require manual coding. If you install a new theme down the road, these changes will need to be re-applied.

The rest of this guide gets a bit technical! We can take care of setup for Locksmith subscribers, so if you're interested, make sure your subscription is in good standing, then email me isaac@uselocksmith.com. :)

Enabling manual mode

Before proceeding, make sure that your theme is set up for manual locking. Use the next sections of this guide to get the necessary changes in place.

  1. Log in at uselocksmith.com, then click on the lock for which you'd like to use manual mode.
  2. Click the "Advanced Settings" button (near bottom of the settings form), and tick the checkbox for "Enable manual locking". Then, hit the save button.

That's it! Locksmith will hold off on its full-page protection with this enabled, and allow your custom code to enforce protection.

Updating your theme for manual locking

These updates will take place in either a layout, or in a template/snippet. The distinction is important: Locksmith makes access decisions based on the active content, and while a layout can contain many different kinds of content, templates and snippets are geared more specifically to particular kinds of content.

Layout files

  1. Open up your layout/theme.liquid file (or the other layout that you wish to change).
  2. Add {% include 'locksmith-variables' %}  at the very top of the file.
  3. Find the code you want to hide from unauthorized viewers, and wrap it with {% if locksmith_access_granted %}...{% endif %} . To hide prices, you'll be looking for elements like {{ product.price }} and {{ item.price }}  and your add-to-cart button.
  4. Save! :)

Template or snippet files

  1. Open the Liquid file you want to edit.
  2. Think about the Liquid object that you want Locksmith to examine when deciding whether or not to grant access. Add {% include 'locksmith-variables', locksmith_scope: 'subject', locksmith_subject: product %}  (or page , or collection , etc) in a place where the variable for that object is available.If you want Locksmith to look at the current page for your page template, or the current product for your product template, etc, this line can go at the very top of the file. Otherwise, insert it right after the variable that you need is initialized (for example, right after {% for product in collection.products %}  inside a collection template).
  3. Find the code you want to hide from unauthorized viewers, and wrap it with {% if locksmith_access_granted %}...{% endif %} . To hide prices, you'll be looking for elements like {{ product.price }}  and {{ item.price }}  and your add-to-cart button.
  4. Save! :D


Example: 

This shows Locksmith manual locking code wrapping an entire price section, which I've highlighted.

Did this answer your question?