Return to site

1,500+ brands are using us to grow their online B2B.

Are you ready to revolutionize the way your B2B customers order from you from just $49 per month?

  • Let you customers place and manage orders online
  • Use your existing website for your B2B customers
  • Rapid setup, get up and running in record time
  • Empower your sales team with sales agent ordering
  • Automate previously manual tasks, and much more!

Trusted by 1,500+ brands including


🚀 Let's begin your B2B transformation.

In your live demo, we'll go through your current B2B challenges, how we've helped brands like you, and run through some of SparkLayer's main features relevant to you.

Alex Weston

We'll get back to you 4 hours (typically sooner!) to arrange a good time to speak. Alex Weston, Sales Director

You can also email us at

3 powerful ways to configure B2B-only products and collections on Shopify

Chris Mattingly, Co-Founder

August 8, 2022
Best Practice Guide
3 powerful ways to configure B2B-only products and collections on Shopify

One of the more common requests we see is around how best to set up product ranges within Shopify that only specific customer segments can see when they login. In the case of B2B, many merchants have products - or collections of products - that are exclusive only to their wholesale customers and it’s important that regular retail customers aren’t able to view or purchase them.

If you’re running a hybrid B2C and B2B store on Shopify, this can actually be more challenging than it sounds. Within Shopify’s native functionality, there’s no built-in way to easily differentiate which products can be seen by which customer types and it does require some creative workarounds.

What you'll learn

Shopify’s new customer segmentation functionality is likely to solve this in the future, but until then, we’ve included our top 3 ways to solve this:

  1. Creating B2B-only collections that only your B2B customers can see
  2. Hiding products via coding to create a more custom experience
  3. Using an app to make ongoing management easier

1. Creating B2B-only collections

One of the easiest ways to set up restricted products is to simply create a dedicated ‘B2B collection’ within Shopify that only shows products you’ve selected. For example, you may have a range of 20 products that you’ve specially tagged (e.g. with a tag of ‘b2b-only’) and when a customer signs in, you can simply redirect them to this collection page (e.g. Each time you add or edit your B2B product range, this collection page will automatically update to display the latest product ranges. This approach is particularly good if you have a relatively simple product catalogue and a limited number of collections.

Shopify B2B Login page

Hiding the collection

Once you’ve set up your B2B-only collection, you need to then ensure that regular retail customers can’t access it. A good way to do this is to set up a ‘redirect’ within your Shopify theme that simply redirects non-B2B customers to a different URL. Within your Shopify theme, open the /layout.theme.liquid file and include the following code snippet within the tag.

Important to note

When configuring a collection within Shopify to include products with a certain tag, you’ll need to make sure that other existing collections ‘exclude’ these products from showing. Depending on how many collections you have within your Shopify store, this may require significant initial overhead to set up and will require ongoing maintenance.

2. Hiding products via custom coding

A more robust method to configure B2B-only products is to apply special coding to your Shopify theme that automatically hides or shows products based on certain conditions. In this use-case, using the built-in Shopify product tagging system, it’s relatively straightforward to hide specific products until a B2B-customer successfully logs in. Let’s run through an approach you can use.

Shopify B2B Only Product page

Configuring in Shopify

To get started, find the product(s) within your Shopify catalogue and assign them with an additional tag of b2b. Once tagged, we can then ensure that this product will be hidden from all customers other than B2B customers. Next, ensure that your B2B customers are similarly tagged with b2b. In this case, once you've tagged the customer we're then able to recognise on your Shopify store that they are a B2B customer.

Shopify B2B Only tags

Once you've tagged your products and customers, you'll then need to apply some special code snippets that will ensure your B2B tagged products only show for logged in B2B customers. Within your storefront code, you'll need to find the file that controls how products are displayed on a collection page. Specifically, you'll need to isolate where the Shopify 'product loop' happens. If you're using the Shopify Dawn theme, you can edit the sections/main-collection-product-grid.liquid file and add the below code snippet.

Once this code is added, only signed in B2B customers will be able to see your B2B tagged products!

B2B only product detail pages

With the above set up, it is still possible for a non B2B customer to view the product detail page, even though a product has been tagged as B2B only. To solve this, you can apply a special redirect that simply takes non-logged in customers to a different URL if they try.

Shopify B2B Product template

Within your Shopify theme, locate the main product detail page liquid file. In the Shopify Dawn theme, this file can be located at sections/main-product.liquid. At the very top, simply add the following code. If the product has been tagged with b2b and a non-B2B customer accesses it, it will redirect them back to the homepage.

Important to note

This approach will require a good level of understanding of the Shopify theme language in order to make the necessary code changes and adapt as required. If you change your Shopify theme, you’ll also need to make sure these changes are re-applied accordingly.

3. Using the Locksmith app

A really strong option to creating B2B-only products is to use the popular Shopify App, Locksmith. Locksmith is one of the longest standing Shopify apps and is specifically designed for merchants needing to ‘lock down’ specific areas of their website. Whether that’s B2B products in this case, collections, or even specific landing pages.

Shopify B2B Login page

One of the main benefits of using this app is it negates the need to do any custom coding or configuration. Once installed, you can simply set up your products with specific tags, set your rules within the Locksmith app, and it’ll take effect right away on your Shopify store.

For merchants looking for an easy way to achieve B2B-only content, this is a simple and maintainable way to go about it.

Important to note

The Locksmith solution is designed to work across all Shopify merchant stores and, as part of the installation, code snippets will be added to your Shopify theme. As with item 2 above, you’ll need to make sure these are carried over should you ever change theme. It’s also important to factor in the ongoing running costs of using additional apps versus one-time code changes, but overall Locksmith does represent very good value for money in the time it saves, and features it offers.


So there you have it, our top 3 ways to create B2B-only products on Shopify! The best option really depends on a number of factors, from the size of your B2B catalogue, your familiarity with the Shopify code, and whether you’re looking to hide more than just products, e.g. by using the Locksmith app.

The above enhancements are all great ways to make your Shopify store even more B2B friendly and we hope you find them useful. With the addition of SparkLayer, you can go a step further and enable a powerful and feature-rich B2B ordering experience, making it easy for your B2B customers to place orders, track orders, and even re-order. With SparkLayer enabled, you'll benefit from:

Learn more

To learn more about how SparkLayer works with Shopify and Shopify Plus, please feel free to arrange a demo and we'll run you through the SparkLayer features and how it can integrate with all your systems.

Chris Mattingly

Chris Mattingly

Co-Founder & CEO, SparkLayer

Chris is an experience eCommerce specialist, co-founding UK eCommerce agency blubolt in 2006. For over a decade, Chris helped build and oversee their proprietary platform and worked with some of the UK's fastest growing retailers. At SparkLayer, Chris oversees the product strategy and - when he's not playing peekaboo with his daughter - enjoys staying active with golf, tennis, climbing, and hiking to name a few!
Back to all news