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
      • Custom Liquid key-condition 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
  • Preventing access to the checkout from the cart
  • Managing cart access based on products in the cart
  • Preventing checkout with mixed products from two different groups of products. Eg. Wholesale and Retail
  • Limitations:
  • Something else not covered here?

Was this helpful?

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

Restricting the cart for mixed products and combinations of products

PreviousHow to access your browser's dev toolsNextLocking products by vendor

Last updated 4 months ago

Was this helpful?

This is an incomplete guide! In an effort to share the information we have as soon as possible, this guide has been started and published here in what we consider to be an incomplete state. If something is missing, please let us know by emailing us at .

Locksmith can be used to restrict checkout from the cart page by creating a lock for the cart. This lock can be used to hide the whole cart page, or to only lock the checkout buttons on the cart page. Locksmith has a few cart specific key conditions that can be used to check specific attributes of a customers' cart. This guide will primarily focus on the use of the β€œhas a certain product in their cart” key condition.

Preventing access to the checkout from the cart

Our guide on setting up a cart lock is linked below. That guide covers both locking the whole cart page and locking the checkout button.

Locking the checkout button can be a better option here. This will allow customers to still be able to edit the products in the cart, even when the checkout button is locked.

Managing cart access based on products in the cart

There are three general ways of restricting access to the checkout via your Shopify cart based on mixed products or combinations of products. Keep in mind, this isn’t an exhaustive list.

Preventing checkout with mixed products from two different groups of products. Eg. Wholesale and Retail

The "Look for products matching…" field on the "has a certain product in their cart" key condition can be used to check for a product title, or product tags. For example, "tag:wholesale will check for any products with the "wholesale" tag.

You will need to create three separate keys for your cart lock. Our guide on adding keys is here for reference:

1. You’ll need a key that grants access if a customer does have products tagged with the "wholesale" products tag (for example) in the cart, but only if the customer doesn't have any products tagged with "retail" in the cart.

  • Create a key and then select the "has a certain product in their cart" key condition and add β€œtag:wholesale” to the "Look for products matching…" field on the condition.

  • Then a second "has a certain product in their cart" key condition with the first, add β€œtag:retail” to the "Look for products matching…" field on the condition, and then the condition. You should have a key that looks like the following image.

2. The second key will use a set of conditions that are the inverse of the fist key, to grant access to customers who don't have any products tagged with "wholesale" in the cart but do have products tagged with "Retail" in the cart.

  • Create a new key by clicking the β€œ+Add key” button and then select the "has a certain product in their cart" key condition and add β€œtag:retail” to the "Look for products matching…" field on this condition.

  • Then combine a second "has a certain product in their cart" key condition with the first, add β€œtag:wholesale” to the "Look for products matching…" field on the condition, and then invert this condition. You should have a key that looks like the following image.

3. This third key is only required, if you have another set of products, other than wholesale and retail, that can be purchased with anything product.

The third key can be used to grant access for when there are no products with the "wholesale" or "retail" tags in the cart. This will require the combination of two inverted "has a certain product in their cart" key conditions, one of each product tag.

You should have a key that looks like the following image.

Limitations:

  • The method locks down the cart page only. The cart page is always found at the '.../cart' link in your store (e.g. www.example-store.com/cart). Using other types of carts (slider, dropdown, dynamic/ajax, etc.) or adding "Buy Now" links to your store (which point the customer directly to checkout without going through the cart page) will not work with this method.

  • Locking the checkout area itself is not possible using Locksmith. So any check out links that lead straight to checkout including "Buy Now" button, upsell links, or abandoned cart links can't be used with this method. Please see Setting up checkout validation with Locksmith

Something else not covered here?

Let us know by emailing us at team@uselocksmith.com

πŸ”†
team@uselocksmith.com
Restricting checkout from the cart
Creating keys
combine
invert
Combining Key Conditions
Inverting conditions in Locksmith
Image 1. Key with key condition combination to allow access for wholesale products with no retail.
Image 2. Key with key condition combination to allow access for retail products with no wholesale.
Image 3. Key with key condition combination to allow access when no wholesale or retail products are in the cart.