There are two setup components for this scenario: some modifications to your shop's theme to protect just the checkout button, and the Locksmith lock and key configuration itself.

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. :)

First up: Theme changes

In this portion, you'll update your shop's theme to protect just the checkout button(s) on your cart, allowing your visitors to manage their cart but not check out until they meet your criteria.

Open the "cart.liquid" file (under "Templates"). If you have a newer "sectioned" theme, you may actually need to edit the "cart-template.liquid" file (under "Sections")

Add {% include 'locksmith-variables' %} at the very top of the file.

Find the checkout submit button(s), and wrap this code with {% if locksmith_access_granted %} ... {% endif %} . You can also add an "else" section to show a message to anyone who's been prevented from checking out.Here's a pretty typical example:

Next: Locksmith configuration

Click the link beneath the search box for locking your cart, then click the cart option that appears, and click Save.

On the next screen, under Settings, click on Advanced, and then enable manual locking using the checkbox.

Then, use the "Keys" section to determine under what circumstances the visitor should be allowed to check out. Commonly, you'll want to use the "the visitor has at least $x in their cart" option, which will let you determine an order minimum. Make sure to save the key when you're done!

Finally: Check your customer account settings

If your customer account settings are set to "Optional", and only signed-in customers are subject to checkout restrictions, they could bypass those restrictions by signing out when the items are already in the cart.

You can fix that by adding this bit of code to your layout/theme.liquid file, just below the <body> tag:

This will clear the cart when the logout button is pressed, preventing that workaround.

A note about Abandoned Cart emails

If you have abandoned cart emails enabled on your shop, either through the built-in Shopify feature or an app, those emails may allow the customer to circumvent checkout restrictions.

These emails can send the customer directly to the checkout process without touching the cart page. The customer will be able to check out with whatever amount was in the abandoned cart, whether or not it passes your restrictions.

Your checkout restrictions may not work 100% of the time if you're sending abandoned cart emails, so keep that in mind when you're setting this up. :)