How can I display stock levels to logged-in b2b customers only?

Hi!

Currently I am working on a website for selling to b2c and b2b customers. After the b2b customers login, they will see their purchase price (I already found an app for that), but I would also like to show the stock levels to the b2b customers. If I add this option to the theme, then it will also be visible for the b2c customers, so this is not an option.

So, my question is: is there a way to show to logged in b2b customers only the available stock levels on the product page? Maybe to show it to customers with a special customer tag?

I hope someone can help me out. The theme that I am using is Dawn.

Please let me know if you need more info.

There is a way to show stuff only to B2B customers. If you use the code below, it returns either true or false.

{{ customer.b2b? }}

Then you can use that to build something like:

{% if customer.b2b? %}
show some stuff for b2b customer
{% endif %}

Liquid objects (shopify.dev)

Thank you for your quick reply! Is this B2B function not only available for Shopify Plus members? I don’t have Shopify Plus.

If that is the case, how are you differentiating the b2c and the b2b customers?

With customer tags. So I thought maybe that can be used in the coding as well.

Yes, there we go. Okay, here is an updated code:

{% if customer.tags contains "b2b" %}
show some stuff for b2b customer
{% endif %}

It worked! Thank you so much!

1 Like

You’re welcome!