App block settings
Applies toShopify
How it works
The SparkLayer app embed loads the Core Script (the SparkLayer code on your storefront) for signed-in B2B customers. Retail customers and signed-out visitors don't get it, so none of the settings on this page change what they see.
As it loads, the app embed:
- Sets the Core Script options SparkLayer needs to run on your store.
- Matches SparkLayer's colours and fonts to your theme's, then applies your CSS variable overrides on top.
- Hides the retail prices, buy buttons and other parts of your theme B2B customers shouldn't use, plus anything in CSS selectors for hidden elements.
The styling and hiding are part of the automatic install. If your developer has turned off the automatic install, the 2 styling settings do nothing on their own: see If the automatic install is off.
Change colours and fonts in the theme editor
- Go to
SparkLayer Wholesale,Setup,Theme setup (in your Shopify admin) and click Edit beside the SparkLayer block. Shopify's theme editor opens at the app embed. - Under Styling, enter your CSS variables in CSS variable overrides, one per line.
- Click Save, then sign in to your store as a B2B customer to check the result.
For example, to set your brand colour and fonts:
--b2b-brand-color: #1A4D8F;
--b2b-brand-color-hover: #133A6B;
--b2b-brand-font: Arial, sans-serif;
--b2b-brand-font-heading: Georgia, serif;Each line is a variable name starting with two hyphens, a colon, the value and a semicolon. Leave out <style> tags, :root { and comments. Lines that aren't a variable are ignored, so you can paste the variables from the recommended starting CSS without its first and last lines.
For what each variable changes, see the CSS variable reference. The 4 brand values are enough for most stores.
Overrides and CSS in your theme's code
Your overrides are applied after SparkLayer matches your theme's colours and fonts, so they win over those. They're added near the top of the page body, after your theme's <head>, so they also win over the same variables set in theme.liquid. Keep each variable in one place to avoid surprises.
Hide elements from B2B customers
On a store that sells retail and B2B, some parts of your theme, such as a retail price or a subscription widget, shouldn't show to B2B customers. SparkLayer already hides the common ones for your theme. To hide more:
- Go to
SparkLayer Wholesale,Setup,Theme setup (in your Shopify admin) and click Edit beside the SparkLayer block. - Under Styling, enter a CSS selector for each element in CSS selectors for hidden elements, one per line.
- Click Save, then check your store as a B2B customer and as a retail customer.
.product__inventory
.announcement-bar
#loyalty-widgetA selector is how CSS finds an element: .name for a class, #name for an ID. Your browser's developer tools show an element's class and ID when you inspect it. A line that isn't a valid selector is ignored, and the other lines still apply.
To hide an element in your theme's code instead, add data-spark="b2c-only" to it. See Install the widgets yourself.
Add Core Script options
Core Script options turn features on and off and change how they work, such as the language or where signed-in customers go from the account page. On Shopify, the app embed sets the options SparkLayer needs. Your developer adds any others in theme.liquid:
- In your Shopify admin, go to Online Store,Themes (opens in your Shopify admin in a new tab), open the … menu on your theme and click Edit code.
- Open
layout/theme.liquid. - Paste a
window.sparkOptionsblock just before the closing</head>tag, with your options inside it. - Click Save, then check the change on your store as a B2B customer.
<script>
window.sparkOptions = {
accountRedirect: {
urlRegex: /\/account/g,
goTo: '/collections/all',
},
};
</script>Shopify adds the app embed after your theme's <head> content, and the app embed combines your options with its own, so there's nothing else to add. Set all your options in this one block: a second window.sparkOptions = {…} in your theme replaces the first. For every option, see the Core Script options.
Product block settings
The product blocks place SparkLayer's interfaces exactly where you want them on a page. Each block has settings in the theme editor, which match the tag settings in your theme's code. Click a block in the theme editor to see them.
| Block | Setting | Tag setting | What it does |
|---|---|---|---|
| SparkLayer Product Page | Mode Table Only | mode-table-only | Shows every product as a table, even with one variant |
| Mode All Variants | mode-all-variants | Shows all variants in one table | |
| Show Barcode | show-barcode | Shows the barcode | |
| Hide Dropdowns | hide-dropdown | Hides the drop-downs for the options you list, for example Size, Color | |
| Hide Columns On Mobile | hide-on-mobile | Hides the table columns you list on phones, by option name or Stock | |
| SparkLayer Product Card | Show SKU | show-sku | Shows the product code |
| Show Stock | show-stock | Shows stock status | |
| Show Barcode | show-barcode | Shows the barcode | |
| Mode Quick Buy | mode-quick-buy | Shows products as table rows | |
| Hide Dropdowns | hide-dropdown | Hides the drop-downs for the options you list | |
| SparkLayer Product Price | Exclude Price Breaks | exclude-price-breaks | Leaves quantity price breaks out of the price shown |
| SparkLayer Product Matrix | Show Barcode | show-barcode | Shows the barcode in the product matrix |
Every block also has a Product setting. On a product page or in a product grid, connect it to the page's product, so the block shows the right one. The SparkLayer Product RRP block has no other settings.
For the SparkLayer Form block, see Embedding and styling forms.
If the automatic install is off
This is for developers. With disableAutoInstall set, the app embed still loads the Core Script, but doesn't add the interfaces, match your theme's styling or hide anything. CSS variable overrides and CSS selectors for hidden elements only apply when you call the functions that use them. The app embed's script adds the functions when it loads, so call them once the page has loaded:
<script>
window.addEventListener('load', () => {
if (!window.sparkShopify?.injectSparkStylingBehaviour) return; // not a B2B customer
// Matches SparkLayer to your brand, then applies CSS variable overrides
window.sparkShopify.injectSparkStylingBehaviour({
'--b2b-brand-color': 'var(--color-primary)',
'--b2b-brand-color-hover': 'var(--b2b-brand-color)',
'--b2b-brand-font': 'var(--font-body-family)',
'--b2b-brand-font-heading': 'var(--font-heading-family)',
});
// Hides these elements, plus CSS selectors for hidden elements
window.sparkShopify.injectSparkHidingBehaviour(['.price', 'product-form']);
});
</script>Calling either function again replaces what it added before. To turn off the automatic install, see Turn off the automatic install.
FAQs
Check you're signed in as a B2B customer: the overrides only apply to them. Check each line starts with two hyphens and ends with a semicolon, and that the automatic install isn't turned off. Your browser's console lists each line it ignored, starting [SparkLayer-AppBlock].
Either works. CSS variable overrides need no code. CSS in theme.liquid can do more, such as style a single element, and suits a developer who already looks after your theme's code. See Customising the design.
Yes. App embed settings are saved with each theme, so a new theme, or a fresh copy of an updated theme, starts with them empty. Copy them across from the old theme's app embed.
No. The app embed only has the 2 styling settings. Add Core Script options to theme.liquid: see Add Core Script options. Many options, such as checkout fields and payment methods, are also settings at
SparkLayer Wholesale,Storefront,Options (in your Shopify admin), with no code.
Next steps
Last updated