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.

What variables can I use in a stock rule and how are they parsed?

Stock Rule Variables
free  - On hand minus reserved inventory.
on_hand - Inventory physically on the shelf in the warehouse.
reserved  - Inventory held for unshipped orders
fba  - FBA inventory.
skip  - Skip this item, do not push quantities for it.
store_default - Use the store's stock rule configurable in settings.

What functions are available in a stock rule and how are they parsed?

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)

The above rule essentially means, "Push the lower quantity between free - 2 and 10. Never push more than 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)


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)

Include incoming with pushed stock

To enable including incoming with pushed stock, update the stock rule for your store.

free + incoming_due_by(30)
  • This rule includes both available free stock and incoming stock from POs due within the next 30 days. The number of days due can be adjusted higher or lower as desired.

Divide across listings

Dynamically split stock advertised to multiple listings, prevent advertising 100% if inventory for a single item in multiple places, prevent overselling.

Note: Typically applied to the store's stock rule. If only targeting a single item to divide stock, then apply the rule to each listing linked to that item.

divide_across_listings(stock_rule, num_unique_listings, multiplier, fixed_reserve)
  • stock_rule — any regular stock rule

  • fixed_reserve — extra fixed reserve constant (e.g. 10 reserves extra 10 units).

  • num_unique_listings — number of active listings linked to an item/kit. Can be a constant or literal "num_unique_listings" to be used with actual number of listings. (e.g. if constant 3 is provided, the available quantity would be divided 3 ways).

  • multiplier — allows inflating or deflating by desired factor. (e.g. 0.80 multiplier advertises 80% of the calculated amount).

Basic usage:

divide_across_listings(free, num_unique_listings)

Advanced usage:

divide_across_listings(free, num_unique_listings, 0.90, 5)
  • Uses calculated free quantity

  • Hold 5 units of additional reserve

  • Divides automatically across active number of listings

  • Advertises only 90% of available stock

Did this answer your question?