Stock display
How it works
SparkLayer reads stock from your eCommerce platform, or from your own system if you send it through the SparkLayer API. Whether you manage stock by hand or from an ERP, B2B customers see the same numbers. The customer group's stock display settings then decide how customers see that stock.
Stock in your platform
Customer group rules
Status shown
How the status is chosen
SparkLayer works from the available quantity of each variant. On Shopify, that's the Available quantity: stock on hand minus units committed to open orders. For example, 1 unit on hand that's committed to an order counts as 0 available, so with Continue selling when out of stock on, the variant shows as pre-order.
Customers see one of these statuses, each with a coloured dot:
| Status | Colour | When it shows |
|---|---|---|
| In stock | Green | Available stock is above the Low threshold. If you show units, stock above Max shows as, for example, 100+. |
| Low stock | Amber | Available stock is above 0 and at or below the Low threshold. Customers see the number of units left. |
| Last stock | Amber | Only the last items are left, as set by the Last threshold. |
| Pre-order | Blue | Available stock is 0 or less, and your platform allows the variant to be sold when it's out of stock. See pre-orders and back-orders. |
| Out of stock | Red | Available stock is 0 or less, and selling when out of stock is off. The variant can't be ordered. |
| Unavailable | Red | Usually, the customer's price list has no B2B price for the variant. See Why a product shows Unavailable. It also shows when the variant has been made un-sellable: see How products are shown. To show "Price on application" instead, see Show "price on application". |
Stock labels that come from your own theme, rather than from SparkLayer's interfaces, aren't changed by any of the settings on this page.
Which setting hides which label
All of these are in the customer group's Stock display rule, at Customers,Groups (opens in your SparkLayer Dashboard in a new tab):
| To hide | Do this |
|---|---|
| In stock, Low stock, Last stock and Out of stock | Untick Show stock availability to customers. This doesn't hide the pre-order label. |
| The Pre-order label | Tick Hide pre-order. |
| The exact number of units | Untick Show number of units of stock. |
Show stock levels to customers
You choose what each customer group sees. Stock display settings need version 2.0 or later of the Core Script, the SparkLayer code in your theme. If you're not sure which version you have, ask your developer or see How do I show stock on a SparkLayer version before 2.0?.
- Go to Customers,Groups (opens in your SparkLayer Dashboard in a new tab) and click a group's name. To apply the settings to every group, click Edit on the base customer group instead: the other groups inherit from it.
- Under Inherited rules, click + Override next to Stock display (on the base group, + Customize). The rule moves up to Customized rules.
- Click Configure and tick Show stock availability to customers.
- To show exact numbers, tick Show number of units of stock and enter the Max, Low and Last values.
- Click Save.
Changes to a customer group's rules apply straight away. There's nothing to publish and no sync to wait for.
| Setting | What it does |
|---|---|
| Show stock availability to customers | Customers see the stock status of each product and variant. Pre-order is always shown unless Hide pre-order is ticked. |
| Hide pre-order | Hides the pre-order stock status from customers. |
| Show number of units of stock | Shows the exact stock number, up to the Max value. |
| Max | The highest number shown, in green. Anything above shows as, for example, 100+. |
| Low | The low stock threshold. Low stock shows in amber. |
| Last | The last stock threshold, for the last remaining items. |
Show the stock key on desktop
On smaller screens, customers see a stock key under the variants table in the product detail interface when stock display is on. It explains each colour: In stock, Out of stock, Pre-order, Low stock and Last stock.
To show the stock key on larger screens too, you or your developer add this line to your custom CSS:
--spark-pdp-stock-key-desktop: flex;Set a stock level display limit
To cap the stock number customers see on product pages, go to Settings,Configurations (opens in your SparkLayer Dashboard in a new tab) and enter a number in Stock level display limit. For example, with a limit of 100, customers see 100+ when you have more than 100 in stock.
Show stock on product cards
The product card interface can show customers live stock on collection pages too. See Show stock status.
Allow pre-orders and back-orders
Customers can add a pre-order (or back-order) product to an order even when it's out of stock. They see a pre-order message next to it, such as On Backorder or Pre-order.
Set up pre-orders on Shopify
Shopify only
- In the Shopify admin, open the product or variant.
- In the inventory section, tick Track quantity and Continue selling when out of stock.
- Set the Available quantity to 0 or less, then click Save.
"Continue selling when out of stock" applies to retail customers too, so they can also buy more than you have. To limit this, you can create separate products that only B2B customers see. See Sell pre-order products to B2B customers only.
On other platforms, see the developer docs. Pre-orders and back-orders aren't supported on BigCommerce (see Compare platforms).
Change the pre-order message
You can change the pre-order message customers see without code. At Storefront,Options,Translation overrides (opens in your SparkLayer Dashboard in a new tab), add a translation override for pdp.messaging.back-order (product page) and product-card.messaging.back-order (product cards). See Languages and international.
For developers: set the text in the Core Script
translations: {
en: {
"pdp.messaging.back-order": "Pre-order",
"product-card.messaging.back-order": "Pre-order",
}
},<!-- SparkLayer Core Script: in your theme, just before </head>.
Already have window.sparkOptions? Add just the setting to it. -->
<script>
window.sparkOptions = {
translations: {
en: {
"pdp.messaging.back-order": "Pre-order",
"product-card.messaging.back-order": "Pre-order",
}
},
};
</script>Limit how many units can be pre-ordered
You can set exactly how much stock of a variant customers can pre-order or back-order. Use the sparklayer.min_stock_level metafield, entered as a negative number: -20 lets customers order until stock reaches -20.
- Make sure the field exists. On Shopify, go to Integrations,Platform (opens in your SparkLayer Dashboard in a new tab) and, in the Metafields card, click Configure next to SparkLayer metafields. On other platforms, use the metafield reference.
- On each variant, set
sparklayer.min_stock_levelto a negative whole number, for example-6,-12or-20.
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
Set a different limit for each stock location
If you use stock locations, you can set the level for each location instead, with the sparklayer.stock_location_data field. Enter each location's ID from your eCommerce platform and its limit, and the form writes the value, for example [{"location_id":"123","min_stock_level":-150}]:
sparklayer.stock_location_dataShow a restock date
A restock date tells customers when a pre-order product is expected, for example "Pre-order. Expected shipping date: 17th April". Use it for a "due in" date (when you expect stock) or an "estimated shipping" date (when you expect to ship).
- Make sure the
sparklayer.restock_datefield exists. On Shopify, go to Integrations,Platform (opens in your SparkLayer Dashboard in a new tab) and click Configure next to SparkLayer metafields: it adds B2B - Restock Date. On other platforms, create it with the typedate(see the metafield reference). - On each variant, set the date, for example
17/11/2022for the UK format.
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 B2B - Restock Date under Metafields, then type the values (each variant has its own row) and click Save. Shopify's guide
Set a different restock date for each stock location
If you use stock locations, you can set a restock date for each location with the sparklayer.stock_location_data field. Enter each location's ID and pick its date, and the form writes the value, for example [{"location_id":"123","restock_date":"2023-12-12"}]:
sparklayer.stock_location_dataTo change the restock date wording, add a translation override for pdp.messaging.back-order-due at Storefront,Options,Translation overrides (opens in your SparkLayer Dashboard in a new tab). In the text, {restockDate} is replaced with the date.
For developers: set the text in the Core Script
translations: {
en: {
"pdp.messaging.back-order-due": "Due {restockDate}",
}
},<!-- SparkLayer Core Script: in your theme, just before </head>.
Already have window.sparkOptions? Add just the setting to it. -->
<script>
window.sparkOptions = {
translations: {
en: {
"pdp.messaging.back-order-due": "Due {restockDate}",
}
},
};
</script>The product matrix can show restock dates too, with the show-restock-date setting.
Sell pre-order products to B2B customers only
If you sell to retail (DTC) and B2B customers from one store, you may want B2B customers to pre-order products that retail customers can't buy, for example a pre-season range.
Shopify only
Shopify can't hide or show products, or single variants, by customer type on its own. Make the pre-order version a separate product:
- Create a new product (or range) and set it up as normal, with images and descriptions.
- Tag it
b2b-onlywith the free B2B Catalogs app, so only signed-in B2B customers see it. - In SparkLayer, set up B2B pricing and any settings the products need, such as quantity rules.
Retail customers then can't see these products. This duplicates some product data, but it keeps pre-order products for B2B customers only. A product already in a cart, or added with an add-to-cart link, can still be bought: see B2B Catalogs limitations.
Tag orders that contain pre-order products (Shopify)
Shopify only
The Shopify Flow (opens in a new tab) app can tag orders that contain pre-order products automatically, so your team can find and handle them separately.
Order created
Check product tags
Tag the order
Add a note
Tag your pre-order products
In the Shopify admin, add the tag b2b-pre-order to each product you're selling on pre-order or back-order.
Tag orders with Shopify Flow
Install the Shopify Flow app (opens in a new tab) and create 2 workflows, one starting from Order created and one from Draft order created. In each, check whether any line item's product has the tag b2b-pre-order, and if it does, add the tag b2b-pre-order to the order. Once they're turned on, orders and draft orders containing pre-order products get the tag. Our support team can help you set them up.
Filter your orders
In the Shopify admin, go to Orders (opens in your Shopify admin in a new tab), click Add filter and filter by the tag b2b-pre-order. You can save this as a view, for example Pre-Order, and use it for your internal workflows, such as how you fulfil these items.
Hide pre-order messages
Customers see a product as pre-order when it meets your store's pre-order criteria. On Shopify, that's when Track quantity is on, Continue selling when out of stock is on, and the Available quantity is 0 or less. You can hide the message in 2 ways:
| Where | How | Effect |
|---|---|---|
| In SparkLayer | Go to Customers,Groups (opens in your SparkLayer Dashboard in a new tab), open a customer group and, in its Stock display rule, tick Hide pre-order. | The pre-order status is hidden in the frontend interfaces for that group. |
| On Shopify | Turn off Track quantity or Continue selling when out of stock for the product or variant. | The product is no longer treated as pre-order. On other platforms, see the developer docs. |
Stock locations (inventory locations)
If your store keeps stock in several locations, for example by region, you can choose which location's stock a customer group sees. Stock locations need the Growth plan or above.
- Go to Settings,Configurations,Ordering (opens in your SparkLayer Dashboard in a new tab) and turn on Multi-location stock, then save.
- Go to Customers,Groups (opens in your SparkLayer Dashboard in a new tab) and click a group's name.
- Under Inherited rules, click + Override next to Stock location, then Configure.
- Select a location, for example London Warehouse.
- Click Save. Reset hands the rule back to the base group.
Until a group has a stock location, customers see combined stock from all locations. Each customer group can use one location.
This only changes the stock customers see. It doesn't change which location fulfils the order in your eCommerce platform.
On Shopify, your active locations sync to SparkLayer automatically. On other platforms, stock locations are managed through the Stock API. See Set a stock location for the setup needed on each platform.
Reserve stock for retail customers
If you run retail (DTC) and B2B from one store, both share the same stock, so large B2B orders could leave nothing for retail customers. A reserve stock quantity keeps some stock back for retail:
Reserve set
Both can order
Stock reaches 50
Retail keeps ordering
To set it:
- Make sure the
sparklayer.reserve_stock_quantityfield exists. On Shopify, go to Integrations,Platform (opens in your SparkLayer Dashboard in a new tab) and, in the Metafields card, click Configure next to SparkLayer metafields: it adds B2B - Reserved DTC Stock Quantity. On other platforms, see the metafield reference. - On each variant, enter the quantity to keep back, for example
50, and save.
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 B2B - Reserved DTC Stock Quantity under Metafields, then type the values (each variant has its own row) and click Save. Shopify's guide
To reserve a different amount for each customer group, use Product rules per customer group.
Change stock status messages
When stock display is on, you can change the wording of each stock status customers see. You don't need code: add a translation override for its key at Storefront,Options,Translation overrides (opens in your SparkLayer Dashboard in a new tab). See Languages and international.
| Key | Default text |
|---|---|
pdp.messaging.back-order | Pre-order |
pdp.messaging.back-order-due | Due {restockDate} |
pdp.messaging.out-of-stock | Out of stock |
pdp.messaging.low-stock | Low stock |
pdp.messaging.last-stock | Last stock |
pdp.messaging.in-stock | In stock |
pdp.messaging.un-sellable | Unavailable |
For developers: set the text in the Core Script
translations: {
en: {
"pdp.messaging.back-order": "Pre-order",
"pdp.messaging.back-order-due": "Due {restockDate}",
"pdp.messaging.out-of-stock": "Out of stock",
"pdp.messaging.low-stock": "Low stock",
"pdp.messaging.last-stock": "Last stock",
"pdp.messaging.in-stock": "In stock",
"pdp.messaging.un-sellable": "Unavailable",
}
},<!-- SparkLayer Core Script: in your theme, just before </head>.
Already have window.sparkOptions? Add just the setting to it. -->
<script>
window.sparkOptions = {
translations: {
en: {
"pdp.messaging.back-order": "Pre-order",
"pdp.messaging.back-order-due": "Due {restockDate}",
"pdp.messaging.out-of-stock": "Out of stock",
"pdp.messaging.low-stock": "Low stock",
"pdp.messaging.last-stock": "Last stock",
"pdp.messaging.in-stock": "In stock",
"pdp.messaging.un-sellable": "Unavailable",
}
},
};
</script>Metafield reference
This reference is for whoever sets up your product data. All of these are variant metafields with the namespace sparklayer. On Shopify, create them at Settings,Custom data,Variants (opens in your Shopify admin in a new tab). On other platforms they're variant-level product fields: see the developer docs and your platform's metafields guide.
| Key | Type | Value | Used for |
|---|---|---|---|
min_stock_level | integer | A negative whole number, for example -6, -12 or -20 | Limit pre-order quantity |
restock_date | date | A date in your store's format, for example 17/11/2022 (UK) | Restock date |
stock_location_data | json | One entry per location, with the location_id from your platform and a min_stock_level and/or restock_date (YYYY-MM-DD) | Per-location pre-order limits and restock dates (Shopify) |
reserve_stock_quantity | integer | A whole number, for example 50 | Reserved stock |
Troubleshooting
Check that Show stock availability to customers is ticked in the customer group's Stock display rule (or in the base customer group it inherits from), and that your Core Script is version 2.0 or later. The version is at Storefront,Widgets,Core script version (opens in your SparkLayer Dashboard in a new tab).
Stock messages also need SparkLayer's configuration for your theme to include the stock display setting. If no stock messages show at all, for any customer, contact our support team and we'll check it.
SparkLayer shows the available quantity, not the quantity on hand. On Shopify, units committed to open orders aren't available, so 1 on hand and 1 committed shows as 0. See How the status is chosen.
If the available quantity in your platform still doesn't match, sync first: go to Integrations,Product sync (opens in your SparkLayer Dashboard in a new tab) and click Sync products now. Then search for the variant in Product data lookup. See Product and customer sync.
It may come from your theme rather than SparkLayer. The settings on this page only change the labels in SparkLayer's interfaces. To remove a label your theme adds, change your theme or ask your developer.
FAQs
Shopify only
On Shopify, "Continue selling when out of stock" applies to all customers. To keep pre-order products for B2B customers, see Sell pre-order products to B2B customers only.
Before version 2.0, stock display was set in the Core Script rather than in SparkLayer, so your developer sets it there. See Frontend integration for how to update the Core Script.
display: {
stock: {
show: true,
max: 50,
last: 5,
low: 15,
},
},<!-- SparkLayer Core Script: in your theme, just before </head>.
Already have window.sparkOptions? Add just the setting to it. -->
<script>
window.sparkOptions = {
display: {
stock: {
show: true,
max: 50,
last: 5,
low: 15,
},
},
};
</script>| Setting | What it does |
|---|---|
max | The highest stock level shown to customers. Stock above it shows as "XX+ available". |
last | Tells customers stock is down to its last items, with a red "Last stock" message. |
low | Tells customers stock is low, with an orange "Low stock" message. |
Last updated