Advanced users / developers only!
If you're a developer and want to make a custom stock rule without customer support, this article will help you achieve that goal. Otherwise, please refer to these articles instead.
How are stock rules processed?
Rules are evaluated using a strict subset of javascript.
Stock Rule Variables
free: Net available stock (on_hand - reserved).
on_hand: Current physical stock.
reserved: Stock reserved for open orders.
fba: FBA inventory.
skip: Do not push quantities to this listing.
store_default: Use the store's configured stock rule.
Stock Rule Functions
No more than
Never advertise more than this much inventory as available. Great to fight competitor's repricing tools or to stay under eBay's item limit. Note: This will toggle between being a unit off to ensure stock sync sees a valid change in stock to push regularly.
no_more_than(free, 10)
No less than
Never advertise LESS than this much inventory as available. Directly permit overselling. Note: This will toggle between being a unit off to ensure stock sync sees a valid change in stock to push regularly.
no_less_than(free, 100)
Snapping
Starting with the "start" value only provide rough figures for actual availability. e.g. 50, 100, 200, 400, 1000, 2000, 10000, 20000.
snapping(free, 50)
Incoming inventory from Purchase Orders
Include incoming inventory from POs due within a set number of days. The number of days due can be adjusted higher or lower as desired. This example rule includes incoming stock from POs due within the next 30 days:
free + incoming_due_by(30)
Divide across listings
If one item is listed in several places, SKULabs normally sends the full available quantity to every listing. This function splits that quantity between the listings so the combined total doesn’t exceed what you have. It is usually set as the store’s stock rule. To apply it to one item only, set the rule on every listing linked to that item.
divide_across_listings(stock_rule, num_unique_listings, multiplier, fixed_reserve)
stock_rule: The starting quantity, such asfree.num_unique_listings: How many ways to split. Enter a number (3 splits it three ways), or the literalnum_unique_listingsto use the current count of active listings linked to the item or kit.multiplier: Scales the result. 0.80 sends 80% of the calculated amount.fixed_reserve: A set number of units held back. 10 holds back 10 extra units.
divide_across_listings(free, num_unique_listings, 0.90, 5) takes free stock, holds back 5 units, splits the rest across the active listings, and sends 90% of that.
Kits that share one component
Selling multiple sizes of the same product can risk overselling without a sound strategy.
Example: you stock 60 loose cans of soda. You sell a 6-pack and a 12-pack, and each is a kit that uses the same can SKU as its component.
How many of that kit could 60 cans make if nothing else used them?
6-pack: 60 ÷ 6 = 10 units
12-pack: 60 ÷ 12 = 5 units
Problem: The channel shows both counts at once and tracks them separately. A customer could buy 10 six-packs (60 cans), and another could buy 5 twelve-packs (60 cans) in short succession, before the next stock sync has the opportunity to adjust counts.
The fix: Use a stock rule on each kit listing that limits it to a fraction of the cans. The fractions must add up to 1 or less. Rules round down, so the combined total cannot exceed the cans on hand.
Even split
Divide by the number of kits that share the cans. With two kits, use free / 2 on each listing.
6-pack: 10 ÷ 2 = 5 (30 cans)
12-pack: 5 ÷ 2 = 2.5, rounded down to 2 (24 cans)
Total: 54 cans of 60
Weighted split
If one kit sells more, give it the larger fraction. With free * 0.6 on the 6-pack listing and free * 0.4 on the 12-pack listing:
6-pack: 10 × 0.6 = 6 (36 cans)
12-pack: 5 × 0.4 = 2 (24 cans)
Total: 60 cans of 60
Tips for this approach
Divide by a fixed number: count every kit that uses the cans, across every store that lists them.
Don’t use
num_unique_listings; it also counts listings of other products that share any component with the kit, which can make the counts much smaller than intended.Don’t use
divide_across_listings; it rounds to the nearest unit and can advertise one unit too many e.g. the 12-pack’s 2.5 would round up to 3. That gives 30 + 36 = 66 cans advertised against 60 total.Each sale lowers the can count, and the next sync recalculates both kits, so the fractions apply to the new total without manual changes.
Trade-off: Each kit can only show its fraction. With 20 cans left, the even split gives the 12-pack 20 ÷ 12 = 1, then 1 ÷ 2 = 0.5, rounded down to 0. The channel shows 0 twelve-packs even though 20 cans would fill one. If that happens often, change the fractions.
