Rules and kits in the REST API
Set attribute rules and kit parts through Stockpool's REST API, and assemble or take apart kits made ahead.
Note
This is part of Stockpool Pro.
Stockpool Pro adds to Stockpool's REST API (namespace stockpool/v1, see REST API and CSV export). The same authentication applies.
More fields on pools
POST /pools and PUT /pools/{id} also take, and every pool returned also has:
| Field | Holds |
|---|---|
rules |
a list of rules, each with conditions (a list of attribute and value, e.g. pa_color and red), categories (product category IDs) and qty (amount per item) |
components |
a kit's parts: a list of pool (ID) and qty (amount per kit); an empty list makes it a plain pool |
made_ahead |
true for a kit with its own stock |
can_make |
returned only, for a kit made to order: how many its parts can make (null when every part allows backorders) |
Values are cleaned up the way the editor does (attribute names like attribute_pa_color become pa_color, values become slugs). Parts that would make a kit contain itself are refused with 400 stockpool_kit_loop.
curl -X PUT https://example.com/wp-json/stockpool/v1/pools/12 \
-u ck_xxxxxxxx:cs_xxxxxxxx \
-H 'Content-Type: application/json' \
-d '{"rules":[{"conditions":[{"attribute":"pa_colour","value":"navy"}],"categories":[31],"qty":1.2}]}'
Assembling kits
POST /pools/{id}/assemble with count makes that many kits made ahead from their parts; with "take_apart": true it puts them back. Optional note. It returns the kit, or 400 with the reason when the parts don't allow it or the pool isn't a kit made ahead.
Hooks
stockpool_bundle_itemsadds bundle plugins (see Bundles).stockpool_pro_lemon_squeezy_product_idlimits license keys to one Lemon Squeezy product.
Everything else goes through Stockpool's own hooks (see Filters and hooks).