News and Tips

How to show user-group-specific content

13 July 2015

This is a brief tutorial to outline how to hide/show information based on a customers user group. This is the best-practice way to:

  • Hide pricing for logged-out users
  • Disable add-to-cart for logged out users, or specific price groups (useful for showing add-to-cart only for wholesale customers for example)
  • Change menu items based on whether a customer is logged in or not

It's worth noting that while common sense would tell you it's best to check if a customer has a username or not, to tell if they are logged in, this is not the case. The Neto Web Accelerator does not respect usernames but it does respect user-groups—meaning if you can use user groups for this purpose you should as you don't need to use AJAX at all.

For the purpose of the tutorial we will:

  • Hide product prices for logged out customers
  • Hide product RRP's for everyone except for wholesale customers

Even if this tutorial does not specifically cover the exact customisation you are trying to make, it should be enough to illustrate the best-practice way to implement this kind of customisation.

Step 1 — Setup your Price Groups

We will be using Price/User Groups distinguish between our three different customer types: guests, members and wholesalers.

Price groups are configured under Admin > Customisable Fields > Customer Price Groups. All you need to do in here is rename the price groups you wish to use, so they make more sense.

Let's name Pricegroup A Guests, Pricegroup B Customers and Pricegroup A Wholesalers.

Now, under Admin > System Setup > Customer Settings we need to set our default pricegroup for different customer types.

Step 2 — Template Logic

Hiding product prices for logged out customers and product RRP's for everyone except for wholesale customers is now just a matter of using some template logic.

Firstly, to hide the product prices for logged out customers, we just need to wrap the pricing in the following logic:

<p class="price" itemprop="offers" itemscope itemtype="">
[%if [@user:group_id@] ne '1'%]
[%if [@has_child@]%]from [%/if%]
[%if [@inpromo@]%]
<span itemprop="price">[%format type:'currency'%][@promo_price@][%/format%]</span>
<span itemprop="price">[%format type:'currency'%][@store_price@][%/format%]</span>
<meta itemprop="priceCurrency" content="[@config:defaultcurrency@]">
view raw .html hosted with ❤ by GitHub

To hide the RRP's from everyone but wholesale customers (price group C/3) we need similar logic:

<div class="savings-container">
[%if [@user:group_id@] eq '3'%]
[%if [@inpromo@]%]
<span class="label label-danger">On Sale</span>
[%if [@save@] > 0 and ![@has_child@] %]
<span class="label label-warning">
[%format type:'percent'%][@save@][%/format%] OFF</span>
[%if [@save@] > 0%]
<span class="label label-default">RRP [%format type:'currency'%][@retail@][%/format%]</span>
view raw .html hosted with ❤ by GitHub

Note that you will need to make the changes above to all thumbnail and product page templates (maybe even the cart and print docs too, if that's what you need!)


  • If you already have customers you may need to change your existing data so their price groups are accurate.
  • If you already have special pricing setup for price group A, you can instead use another price group (F for example) as the new default and avoid changing all of your data.
  • You can combine this logic with product group logic to hide certain product groups from certain customer groups.
  • If you're hiding pricing, you'll probably want to hide buying options too.