
Sometimes, you don’t want just anyone checking out in your Shopify store. Maybe you’re running a wholesale/B2B store, a members-only shop, or you offer special perks for registered customers. By default, Shopify lets anyone check out, but with a few adjustments you can restrict purchases to logged-in customers only.
This guide will walk you through the different methods, from simple Liquid code changes to more advanced app-based solutions, so you can choose the best setup for your store.
Why restrict purchases to logged-in customers?
- Wholesale or B2B stores — ensure only approved customers can buy.
- Membership-based stores — hide products behind a login wall.
- Exclusive product drops — reward your community with gated access.
- Better data collection — force account creation for customer segmentation.
Approaches to restrict Shopify checkout to logged-in customers
There are 3 main approaches:
- Liquid-only method (simple redirect) – block the cart/checkout unless the customer is logged in.
- Theme-level gating – hide the “Add to Cart” button and checkout for guest users.
- Apps or custom logic – advanced rules (e.g., only certain customer tags can buy).
Too complicated? Want help setting this up?
1) Simple Liquid redirect method
This is the most common way to restrict checkout to logged-in users.
Step 1: Edit your cart.liquid (or cart-template.liquid)
Find your cart.liquid or cart section file in your theme (/templates/cart.liquid or /sections/cart-template.liquid).
At the very top of the file, add this snippet:
{% if customer == null %}
<script>
window.location.href = "/account/login?checkout_redirect=true";
</script>
{% endif %}
What this does:
- If the user is not logged in (
customer == null), they are redirected to the login page. - Once logged in, they can continue to checkout.
Step 2: Restrict direct checkout links
Some customers might bypass the cart and go directly to /checkout. You can also add a restriction at the checkout button level.
Find where your theme renders the checkout button in the cart form, and wrap it in a conditional:
{% if customer %}
<button type="submit" name="checkout" class="cart__checkout">Checkout</button>
{% else %}
<a href="/account/login" class="btn">Login to checkout</a>
{% endif %}
2) Restrict Add-to-Cart button for guests
If you want to go further and block cart additions for logged-out customers, you can conditionally hide or replace the Add to Cart button on product pages:
{% if customer %}
<button type="submit" name="add" class="product-form__submit">Add to Cart</button>
{% else %}
<a href="/account/login" class="btn">Login to purchase</a>
{% endif %}
This way, guests never even get items into their cart until they log in.
3) Restrict access with apps or custom logic
If you want to:
- Only allow specific customer tags to purchase (e.g., “wholesale”),
- Lock only certain collections/products behind a login,
- Or create a true members-only store,
…then you’ll likely need an app or custom development.
Recommended apps:
- Locksmith (popular for access control).
- B2B/Wholesale Solutions apps in Shopify App Store.
With these, you can set detailed rules such as “Only customers tagged with VIP can view/purchase this product.”
UX considerations
- Customer flow: if you restrict checkout, make sure your login/register links are visible in the header.
- New customers: decide if you want to allow self-registration or if accounts should be approved manually (this can be set in Settings > Customer Accounts in Shopify Admin).
- Messaging: don’t just block — tell users why they need to log in. Add a short line: “This store is members-only. Please log in or create an account to continue.”
SEO note
If you’re running a fully gated store (all products hidden behind login), Google can’t crawl your products. If SEO visibility matters, consider allowing product browsing without login, but restrict cart/checkout only.
Example: Full setup combining all methods
Here’s a combined snippet for product + cart:
{%- comment -%} PRODUCT PAGE {%- endcomment -%}
{% if customer %}
<button type="submit" name="add">Add to Cart</button>
{% else %}
<a href="/account/login" class="btn">Login to purchase</a>
{% endif %}
{%- comment -%} CART PAGE {%- endcomment -%}
{% if customer %}
<button type="submit" name="checkout">Checkout</button>
{% else %}
<a href="/account/login" class="btn">Login to checkout</a>
{% endif %}
Testing checklist
- Try to add products to cart logged out → should redirect to login.
- Try to access
/cartwhile logged out → redirect to login. - Try direct
/checkoutURL logged out → blocked. - Logged-in customers can add to cart and checkout normally.
- Mobile navigation and quick-adds behave the same way.
When to bring in a developer
If you’re running a heavily customized Shopify store, or need tag-based restrictions (e.g., wholesale-only collections), you’ll save time and headaches by having a Shopify developer set this up for you.
We’ll implement the restriction, customize the login/register flow, and test everything on a duplicate theme so your live site isn’t disrupted. Reach out today and we’ll get this live fast.
Final thoughts
Restricting Shopify checkout to logged-in customers is a smart move for wholesale, membership-based, or exclusive stores. With the right Liquid code or app setup, you can make sure only the right customers can purchase from your shop.
If you need help implementing this — or want a custom solution tailored to your business (like wholesale customer tagging or full membership gating) — send us a quick message and we’ll handle the setup for you.

Leave a Reply