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
Hiding from retail shoppers too?
Customer group rules work without a b2b-only tag, but they only apply to signed-in B2B customers. To hide the product from retail shoppers and signed-out visitors as well, tag it b2b-only.
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. - Optional. To hide the product from retail shoppers and signed-out visitors as well, tag it
b2b-onlyin your Shopify admin. - In the form below, enter each customer group's handle 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
To hide the same products from one or more groups, the form in Hide products from customers writes the rule and can hand it to your AI assistant to apply to every product.
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 handle
In the metafield, use the customer group's handle, not its name or its Shopify tag. To find it, go to
SparkLayer Wholesale,Companies,Customer groups (in your Shopify admin), click the group's name and find its Handle (or ID). A customer's Shopify tag is b2b- followed by the handle, so the handle is the tag without its first b2b-:
| Customer tag in Shopify | Handle in the metafield |
|---|---|
b2b-vip | vip |
b2b-customer-group-b | customer-group-b |
b2b-b2b-uk | b2b-uk |
If a handle starts with b2b-, keep it. Only remove the first b2b- from the tag.
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