Tom Sailors
· Refreshed
Brief · Anonymized case study

Wholesale Collection Gate

Hide wholesale collections behind a verified B2B customer tag. Check the tag at collection render time and return a 404 to anyone without it. Remove wholesale links from navigation and search results for retail accounts. Automate or manually verify new accounts within Shopify admin so B2B customers unlock access immediately upon tagging.

A mid-market wholesale distributor on Shopify Plus needed to hide their B2B collections from retail customers entirely, returning a 404 instead of a redirect. The challenge was verifying B2B status at the point of collection access while keeping retail customers from discovering wholesale offerings through search or navigation.
Four pieces
Storefront

Collection Tag Gate

Checks if the logged-in customer has the b2b tag; if not, renders a 404 page instead of the collection.

Theme collection template + Liquid
theme/templates/collection.json (or theme/snippets/collection-gate.liquid called early in the template) liquid
{% assign customer_is_b2b = false %}
{% if customer %}
  {% if customer.tags contains 'b2b' %}
    {% assign customer_is_b2b = true %}
  {% endif %}
{% endif %}

{% if collection.handle == 'wholesale' or collection.handle == 'b2b-only' %}
  {% unless customer_is_b2b %}
    {% assign request.page_type = 'notfound' %}
    {% render 'page-not-found' %}
  {% endunless %}
{% endif %}

{% if customer_is_b2b %}
  <!-- Render normal collection template -->
  <div class="collection">
    <h1>{{ collection.title }}</h1>
    <!-- Your existing collection content here -->
  </div>
{% endif %}
Replace 'wholesale' and 'b2b-only' with your actual collection handles. The tag name 'b2b' must match the tag you assign to B2B customer records in the Shopify admin.
B2B / Wholesale

B2B Customer Tag Sync

Automatically tags customers in Shopify when they sign up through your B2B company portal or are manually approved.

Custom Shopify app + admin dashboard
Admin GraphQL explorer graphql
# Admin GraphQL
mutation TagB2BCustomer($customerId: ID!, $tags: [String!]!) {
  customerUpdate(input: { id: $customerId, tags: $tags }) {
    customer {
      id
      email
      tags
    }
    userErrors {
      field
      message
    }
  }
}

# Variables example:
# {
#   "customerId": "gid://shopify/Customer/123456",
#   "tags": ["b2b"]
# }
Tags passed as an array replace existing tags entirely; to append without removing others, fetch the customer's current tags first, merge, then update.
Storefront

Search & Nav Blackout

Removes wholesale collections from search results and main navigation menus for retail customers; B2B accounts see them normally.

Theme snippets + Liquid conditionals
theme/snippets/main-nav.liquid (or your header/navigation snippet) liquid
{% assign show_wholesale_nav = false %}
{% if customer and customer.tags contains 'b2b' %}
  {% assign show_wholesale_nav = true %}
{% endif %}

<!-- In your navigation or menu loop: -->
{% for link in linklists.main-menu.links %}
  {% assign is_wholesale_collection = false %}
  {% if link.type == 'collection_link' %}
    {% if link.object.handle == 'wholesale' or link.object.handle == 'b2b-only' %}
      {% assign is_wholesale_collection = true %}
    {% endif %}
  {% endif %}
  
  {% unless is_wholesale_collection and show_wholesale_nav == false %}
    <li><a href="{{ link.url }}">{{ link.title }}</a></li>
  {% endunless %}
{% endfor %}
Adjust the collection handle list to match your wholesale collections. This hides links but does not prevent direct URL access — rely on the Collection Tag Gate for that enforcement.
Operations

B2B Verification Workflow

A manual or automated process to review and tag new accounts as B2B within the Shopify admin, so they unlock collection access immediately.

Shopify Flow + admin custom columns
Shopify Flow editor: When → Then flow
Trigger: Customer created or updated (by staff in admin)
Condition: Customer.email contains specific domain (e.g., @yourb2bpartner.com) OR customer added to a specific group/tag
Then: Tag customer with "b2b"
Alternative: Trigger a Shopify admin notification for manual review → Staff reviews → Tags customer in admin directly

For semi-automated: Trigger on order > X value from new customer → Assign "b2b" tag → Send approval email to staff.
Pure automation (domain-based tagging) is fast but may mis-tag. Manual review is slower but safer. Hybrid (threshold-based notification) balances both.

Got a similar problem?

Sketch your build in 30 seconds — voice, type, or attach a screenshot.

Sketch the build →