Skip to content

Catalogs per customer group

Applies toShopify

How it works

Every variant is visible to every customer group by default. To hide a variant from a group, you add a rule to the variant's sparklayer.settings metafield. The rule names the customer group and sets display to false. If all of a product's variants are hidden for a customer, they don't see the product at all.

How a variant rule hides a product

Customer tag

The customer's tag, such as b2b-vip, places them in the vip customer group.
(this flows forward)

Variant rule

The variant's sparklayer.settings rule for vip, or for base, sets display to true or false.
(this flows forward)

Product

If every variant is hidden for the customer, the whole product is hidden.

Tag products b2b-only

Products using customer group metafield rules must still be tagged b2b-only for the visibility rules to apply.

For what each method hides, across SparkLayer's views and your theme's pages, see What hides what.

Set up variant visibility

  1. Create the sparklayer.settings variant metafield. See Product rules per customer group for how to add it.
  2. Tag the product b2b-only in your Shopify admin.
  3. In the form below, enter each customer group's name and choose Yes or No under Show the product. It writes the rule for you.
  4. Click Copy, open the variant, paste the value into the sparklayer.settings metafield and click Save.
Build the value Fill in what you need and leave the rest blank.
Customer group 1
Paste into sparklayer.settings
Fill in a value above

Lots of products? Fill them in one tableShopify

In your Shopify admin, go to Products, tick the products and click Edit products. Click Columns, tick the SparkLayer field under Metafields, then type the values (each variant has its own row) and click Save. Shopify's guide

More detail

The metafield accepts a list of rules. Each rule names a customer group and whether the variant is displayed for that group:

[
{
"customer_group": "group-name",
"display": true / false
}
]

display is one of the sparklayer.settings product settings, which also cover pack sizes, quantity limits and whether a variant can be added to the cart.

Find the group name

On Shopify, customers are placed in SparkLayer customer groups with a tag in the format b2b-[group], where [group] is the group name. In the metafield, use only the group name, without the b2b- prefix. For example, use vip, not b2b-vip:

Customer tag in ShopifyGroup name in the metafield
b2b-vipvip
b2b-wholesalewholesale
b2b-tradetrade

For how customers are matched to groups, see Customer groups.

Use the base group

The special customer group base sets the default visibility for all B2B customers. Use it to hide a product from everyone, then show it to particular groups. For an example, see Hide a product from all B2B customers except one group.

Setting base to false hides the product for all B2B customer groups, even if the product is tagged b2b-only. An entry for a specific group overrides base for that group, so you can show it to that group again.

If you also set a pack size or a quantity limit, put it in the same sparklayer.settings value, inside each group's entry. When a variant has a sparklayer.settings value, individual metafields such as sparklayer.pack_size are ignored. See Which rule wins.

Examples

These are the common rules. Build your own with the form, or copy one into the variant's sparklayer.settings metafield and change the group name.

Hide a product from all B2B customers except one group

This variant is hidden from all B2B customers except those in the vip customer group (customers tagged b2b-vip):

[
  {
    "customer_group": "base",
    "display": false
  },
  {
    "customer_group": "vip",
    "display": true
  }
]

Hide a product from one customer group

This variant stays visible to all B2B customers except those in the vip customer group:

[
  {
    "customer_group": "vip",
    "display": false
  }
]

FAQs

Was this page helpful?

Last updated