Search Bar Help! Want to seperate my search result from wholesaler vs normal customers

Search Bar Help! Want to seperate my search result from wholesaler vs normal customers

A1i
Tourist
4 0 0

Hi everyone,

 

I have a website that has two sides—one for wholesalers and one for my regular clients. 

 

I have coded the website to when an account with wholesaler tag signs into the website, they will see only the wholesale product and vice versa for the standard accounts. The problem I am running into right now is that my regular customer can see the wholesale products ONLY when searching for products in the search bar at the top, it lets them see the Wholesale product and the price.

 

Sure, when they click on it, the website tells the customer that they are not authorized to see the page, but in the search bar, you can see the product name and price. Defeats the purpose of hiding the wholesale products from my regular clients.

 

Can I code, or is there an app on the Shopify store that can separate my search result based on the customer? Ideally, a wholesale customer once signed in, and when they search, the results are only wholesale products and vice versa for my regular clients. 

 

FYI, I have my wholesale side set up by duplicating all my products and then adding a wholesale tag and theme. Now only customers with wholesale tags can access those Wholesale products and place an order. Any other person gets a "please sign in to access this product." 

 

https://www.scrapdivadesigns.com/ ---- Website. 

my theme is Sunrise.

Replies 6 (6)

Not applicable

Hi @A1i,

 

First thought that comes to mind is modify the code that handles the search query or have some script to filter out the unwanted results.

We can send out a collaboration request and do it one day. 

Best,

Sam - Owner/Lead Developer

Achieve Applabs

SocialAutoPost
Shopify Partner
434 59 105

To separate search results based on customer type in your Shopify store, you can use the following steps:

  1. Create separate collections for your wholesale and regular products. This will allow you to easily group and manage your products based on customer type.

  2. Use Shopify's customer tags to tag your wholesale customers as "wholesale". You can do this manually or by using an app that automates the process.

  3. Use the Shopify Liquid programming language to create a search form that filters results based on the customer's tag. You can add this code to your search template file, which is typically located in the "templates" folder of your theme. Here is an example of how you can do this:

 

{% if current_tags contains 'wholesale' %}
  {% assign collection = 'wholesale' %}
{% else %}
  {% assign collection = 'regular' %}
{% endif %}

<form action="/search">
  <input type="hidden" name="type" value="product">
  <input type="hidden" name="q" value="{{ collection }}">
  <input type="text" name="query" placeholder="Search products">
  <button type="submit">Search</button>
</form>

 

This code will check the customer's tags and assign the "wholesale" or "regular" collection to the search query based on their tag. You will need to create these collections in your Shopify admin and add the appropriate products to them.

 

I hope this helps! Let me know if you have any questions or need further assistance.

Was the reply helpful? Click Like to let me know!
Was your question answered? Mark it as an Accepted Solution
Auto post your Shopify products to Instagram, Facebook, Pinterest, LinkedIn and Twitter.
App: Social Schedular
A1i
Tourist
4 0 0

Thank you for your response. I have my Wholesale customers set the way you described, with each one containing the tag "wholesale." I also have a duplicate of each category, where one has a Wholesale tag while there other does not. So when you sign in as a wholesaler, you see the new navigation that contains the Wholesale version of the categories. 

 

I couldn't find the search template on my Sunrise Template. I did find this in themes  pic of coding template.PNG

SocialAutoPost
Shopify Partner
434 59 105

@A1i Do you use the theme's default search bar or any app? 

Was the reply helpful? Click Like to let me know!
Was your question answered? Mark it as an Accepted Solution
Auto post your Shopify products to Instagram, Facebook, Pinterest, LinkedIn and Twitter.
App: Social Schedular
A1i
Tourist
4 0 0

I use the Default search bar. My theme is Sunrise.

Nancy_Drake
Shopify Partner
194 11 21

Hi @A1i 

 

You can use Merchandising rule in AI Search & Product filter to hide products based on customer tags.

AI Search & Product Filter | SB - Check out our Shopify search and filter app to drive more sales