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.
Customer tag
b2b-vip, places them in the vip customer group.Variant rule
sparklayer.settings rule for vip, or for base, sets display to true or false.Product
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
- Create the
sparklayer.settingsvariant metafield. See Product rules per customer group for how to add it. - Tag the product
b2b-onlyin your Shopify admin. - 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.
- Click Copy, open the variant, paste the value into the
sparklayer.settingsmetafield and click Save.
sparklayer.settingsLots 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 Shopify | Group name in the metafield |
|---|---|
b2b-vip | vip |
b2b-wholesale | wholesale |
b2b-trade | trade |
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
We can only guarantee that variants are shown and hidden as expected on products with 250 variants or fewer, because of the way Shopify gives themes access to product variants. See B2B Catalogs limitations.
Last updated