Restricting the cart for mixed products and combinations of products
Last updated
Was this helpful?
Last updated
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 team@uselocksmith.com.
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.
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.
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.
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: Creating keys
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 combine 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 invert the condition. Combining Key Conditions Inverting conditions in Locksmith You should have a key that looks like the following image.
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.
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.
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
Let us know by emailing us at team@uselocksmith.com