Discuss and resolve questions on Liquid, JavaScript, themes, sales channels, and site speed enhancements.
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.
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
To separate search results based on customer type in your Shopify store, you can use the following steps:
Create separate collections for your wholesale and regular products. This will allow you to easily group and manage your products based on customer type.
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.
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.
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
@A1i Do you use the theme's default search bar or any app?
I use the Default search bar. My theme is Sunrise.
Hi @A1i
You can use Merchandising rule in AI Search & Product filter to hide products based on customer tags.
Thanks to everyone who participated in our AMA with 2H Media: Marketing Your Shopify St...
By Jacqui Sep 6, 2024The Hydrogen Visual Editor is now available to merchants in Shopify Editions | Summer '...
By JasonH Sep 2, 2024Note: Customizing your CSS requires some familiarity with CSS and HTML. Before you cust...
By JasonH Aug 12, 2024