Locksmith
Install LocksmithContact us
  • Quick Start
  • 💡Basics
    • A Locksmith Overview
    • Creating locks
    • Creating keys
    • Compatibility with other apps and Shopify features
    • Removing Locksmith
  • 🔆Tutorials
    • Approving customer registrations
    • Creating restricted wholesale products
    • Hiding product prices and/or the add to cart button
    • Selling digital content on Shopify
    • More tutorials...
      • Setting up multiple price tiers
      • Customizing messages
      • Customizing the customer login page
      • Customizing the registration form
      • Customizing the passcode form
      • Customizing Locksmith’s "Access denied content" messages, and redirecting customers
      • Customizing the email list signup form
      • Showing multiple prompts on the same page
      • Showing content only to specific Markets
      • Input lists
      • Protecting against bots
      • Earn recurring revenue on your exclusive content using ReCharge
      • Use Locksmith and PayWhirl together to grant access based on subscriptions
      • Liquid locking basics
      • Restricting checkout from the cart
      • Confirmation key condition
      • Restricting customers to a specific collection
      • Passcode-specific redirects
      • Grow your subscriber lists with Klaviyo
      • Use Klaviyo as an access control list
      • Use Mailchimp to collect customer emails
      • Hiding out-of-stock products
      • How to use a private browsing session
      • Granting access to variants by visitor input
      • Offering different variants by postal code
      • Locking products by tag
      • Locking multiple pages at once
      • Making a product accessible exclusively from the direct product link
      • Creating private team areas
      • Importing customers in bulk
      • Disabling Locksmith for certain theme files
      • Adding translations to your Locksmith messages
      • Redirecting using Locksmith
      • Locking variants
        • Limiting the scope of variant locks using the product tag key condition
        • Handling JavaScript DOM errors caused by variant locks
      • Locking the customer registration form
      • Locking the search results page in your store
      • How to clear cache for a single website
      • Disabling Locksmith for certain theme files
      • 🛠️Manual mode
      • Grant access for a limited time when using passcodes or secret links
      • Testing Locksmith on unpublished themes
      • Locking blog posts
      • How to access your browser's dev tools
      • Restricting the cart for mixed products and combinations of products
      • Locking products by vendor
      • How do I hide my Shopify store's header and footer
      • Hiding navigation links for locked resources
      • Hiding products from product-grids
      • Restricting a product so that it can only be purchased by new customers
      • Automatically managing the seo.hidden metafield using Locksmith
      • Locking the home page
      • Setting up checkout validation with Locksmith
      • How to hide theme sections, blocks, and snippets
  • 🔑Keys: Access methods in Locksmith
    • About key conditions
    • Customer account keys
    • Passcode keys
    • Secret link keys
    • Visitor location keys
    • More about keys...
      • Inverting conditions in Locksmith
      • Combining key conditions
      • "Has purchased..." key
      • Using the "Force open other locks" setting
      • Liquid key basics
      • Manual mode
      • Excluding content from locks
      • IP address keys
      • Newsletter keys
      • Limiting the scope of variant locks using the product tag key condition
  • 🌻FAQs
    • Why aren't my locks working?
    • FAQ: I see blank spaces in my collections and/or searches when locking
    • Can Locksmith hide content from my in-store search?
    • Locksmith is not working with my page builder app
    • What should I do if my site is loading slowly?
    • I'm the administrator of my site and I cannot access pages because of Locksmith locks.
    • More FAQs...
      • I'm having trouble using Locksmith with a site speed optimization app.
      • The app isn't loading. What do I do?
      • Can Locksmith protect shipping methods, billing methods, or coupon codes?
      • I switched themes, and Locksmith isn't working
      • Why isn't my passcode, secret link, newsletter, or location key working?
      • Can Locksmith lock Shopify's public JSON API for my online store?
      • Why are my customers seeing a reCAPTCHA when logging in?
      • My passcode or newsletter prompt is not updating on my store when I change it.
      • My featured collections on my home page only show one product.
      • My infinite scrolling doesn't show all of my products.
      • My customers have to enter their e-mail address into the Mailchimp key every time they visit.
      • How do I know which customers have used a certain key?
      • Why is Locksmith adding information to my orders?
      • Locksmith isn't installing correctly!
      • Locksmith is not uninstalling correctly!
      • How does Locksmith affect search engines and SEO?
      • How do I change where customers are redirected to after registration on Shopify
      • The thing I want to lock isn't showing up in the Locksmith search
      • I am getting an "already taken" error when trying to create a metafield definition for seo.hidden
      • How do I add a hero banner image to Locksmith's access messages
  • 📒Policies
    • Usage agreement
    • Locksmith's pricing policy: Pay what feels good
    • Privacy policy
    • Data policy
    • Contact us
  • 🔦Developer Tools
    • Locksmith Admin API
    • Locksmith Storefront API
    • Locksmith variables
    • Unsupported functionality
    • Requests from Locksmith
  • More developer docs...
    • Using the Admin API with Locks
  • App Integrations
    • Easy Appointment Booking
Powered by GitBook
On this page
  • 1. Accessing theme hiding profiles
  • 2. Adding a hiding definition
  • 3. What to use for "Liquid variable"
  • 4. How "Replace" works
  • Login to purchase button
  • Passcode button
  • 5. Save and test!
  • How is this different from Locksmith's standard "manual locking"

Was this helpful?

Export as PDF
  1. Tutorials
  2. More tutorials...

How to hide theme sections, blocks, and snippets

Create a theme hiding profile to lock specific parts of your Shopify themes according to your Locksmith lock conditions

PreviousSetting up checkout validation with LocksmithNextAbout key conditions

Last updated 1 month ago

Was this helpful?

By default, when you create a lock on a resource in your Shopify store, Locksmith prevents access to the direct URL for that resource only. For most locks, you can also toggle hiding for:

  • Navigation menu links. .

  • Search results. .

  • For products: product and collection grids/lists. .

If you are wanting to hiding anything beyond the above, or just want more granular control over what is hidden, you can use our "theme hiding profile" feature.

The lock setting to "Enable manual locking" must be enabled to apply Locksmith’s theme hiding rules properly. You can find this option under your lock's Advanced Settings.

1. Accessing theme hiding profiles

Because each theme is different, hiding profiles are added per theme. So, this feature is accessed via the Themes tab. Once there, press the "Edit theme hiding profile" button.

You can also edit hiding profiles for unpublished themes by using the ellipses ("...") button next to each unpublished theme shown.

2. Adding a hiding definition

A hiding definition hides a section, block, or snippet in your theme. One of the most common use-cases for this is to hide prices and/or add-to-cart buttons. To add hiding definitions for this use-case, use these steps:

  1. Press the "Add new definition" button

  2. Leave the "Selection method" at the default (Add by name)

  3. In the "Name..." box, type in "price". Locksmith will show you all of sections, blocks, or snippets that have price in the name:

  1. Add each of the desired definitions. You'll need to repeat the search for each one.

  2. Repeat the above 4 steps for every type that you want to hide. E.g. "quantity", "buy", etc. If you are hiding price and buy buttons, you will likely end up with something like this:

If your theme is one of the free themes made by Shopify from the Shopify theme store, and you are wanting to use this feature for price hiding or buy buttons hiding, try the "theme hiding presets". Instead of choosing "Add by name" under "Selection method", choose "Add from theme presets", then choose either "Price" or "Buy buttons" and press "Add presets". You'll need to add add both presets if you are hiding both prices and buy buttons! Please note that presets will only match newer versions of these themes. Note: Because it is built in a way that doesn't use sections/blocks for price/cart buttons, the "Trade" theme is an exception (you won't find presets for it).

3. What to use for "Liquid variable"

"Liquid variable" is how you specify which Liquid object in the theme Locksmith should base the hiding on. Most use-cases for this feature are geared towards products and most of the time, theme developers simply use product. However, there are some exceptions. A "card product" file might assign to a variable called card_product, or a "featured product" file might use featured_product. If you are not locking a product, you'll want to use the applicable variable (collection, cart, blog, shop, etc).

Ultimately, what you put here depends on what is used in the theme, and if you want to ensure that this is right, it will be necessary to open up your theme code editor to check what is used there.

4. How "Replace" works

Login to purchase button

For conditions requiring a customer login, the following is used as the default replacement to render a "Login to purchase" button that links to the login page. If you wish to customize the appearance of the button, you can copy/paste this code to your "Guest message content" and edit it as needed. It differs slightly depending on if you're using legacy customer accounts or standard.

Standard customer accounts:

<p><a href="/customer_authentication/login?locale={{ request.locale.iso_code }}&?return_url={{ request.path }}" class="btn button button button--full-width button--secondary">Log in to purchase</a></p>

Legacy customer accounts:

<p><a href="/account/login?return_url={{ request.path }}" class="btn button button button--full-width button--secondary">Log in to purchase</a></p>

Passcode button

If you are using a passcode key and need to render a passcode prompt button, use the following code (the button classes may need to be edited):

<p><button class="locksmith-manual-trigger btn button">Enter passcode to purchase</button></p>

5. Save and test!

Once you've added all of your hiding definitions, save your hiding profile. Locksmith will perform an installation to the theme. Once the installation finishes, make sure to verify that everything is working as expected on the frontend of your store!

You can head back to the themes tab to check the status of a specific installation, whether it be for a published theme or not.

How is this different from Locksmith's standard "manual locking"

  • Hiding profiles are easier to setup

  • Hiding profiles don't need manual removal from your theme, they remove themselves when Locksmith is disabled/uninstalled.

  • Hiding profiles rely on the modularity of Online Store 2.0 themes, so manual locking will still be necessary for legacy themes

  • If the hiding target is not contained within a section, block, or snippet, manual locking will still be necessary

If the "Replace" checkbox is toggled on, instead of just hiding the content, Locksmith will replace it with the access denied message or access prompt. These messages can be customized in your locks. .

Hiding profiles are intended to work alongside - or in many cases as a replacement for - . Hiding profiles function in almost the exact same way on the backend. Some differences are:

🔆
More information about customizing messages here
manual locking
More information here
More information here
More information here