Provides guidance on the CrestApps Orchard Core Inventory module: stock items per product/variant/location, the append-only StockMovement ledger, IInventoryService operations, stock holds, back-in-stock alerts, purchase orders, and the Inventory API.
Ships in crestapps-orchardcore. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
Inventory (new in CrestApps.OrchardCore 3.0) counts the units of each product and variant on hand. Counts live outside the content item as stock items, and every change is a movement in an append-only ledger from which the count can be rebuilt.
| Module | Relationship |
|---|---|
Commerce, Products (orchardcore-commerce, orchardcore-products) | Required. Inventory implements Products' IProductAvailabilityProvider and adds the In stock filter. |
Orders (orchardcore-orders) | Optional. Order events hold, sell, release and restock stock. |
Carts (orchardcore-carts) | Caps quantities and refuses sold-out lines through availability |
Shipping (orchardcore-shipping) | Pickup locations take units from an inventory location |
Commerce Webhooks (orchardcore-commerce) | stock.changed, stock.low, stock.sold-out events |
| Feature ID | Name | Depends on |
|---|---|---|
CrestApps.OrchardCore.Inventory | Inventory | Commerce, Products, OrchardCore.Contents |
CrestApps.OrchardCore.Inventory.StockAlerts | Back-in-Stock Alerts | Inventory, OrchardCore.Email |
CrestApps.OrchardCore.Inventory.PurchaseOrders | Purchase Orders | Inventory, CrestApps.OrchardCore.Resources |
CrestApps.OrchardCore.Inventory.Api | Inventory API | Inventory |
CrestApps.OrchardCore.Inventory in the web/startup project and attach InventoryPart to each product type you count.IInventoryService; it works in the caller's YesSql session and is committed with the caller's work.ConcurrencyException at commit. Retry, never open a separate unit of work (SQLite would deadlock).IStockLevelHandler, which runs after commit in its own scope.{ "steps": [...] }.sealed modifier, except View Models.{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.Inventory",
"CrestApps.OrchardCore.Inventory.StockAlerts"
],
"disable": []
}
]
}
All records live in the Inventory YesSql collection.
| Record | Key members |
|---|---|
StockItem | ContentItemId, VariantId, Sku, Title, OnHand, Reserved, Available (OnHand - Reserved), LowStockThreshold, AllowBackorder, ReleaseDateUtc, Archived, Levels per location (StockLocationLevel) |
StockMovement | Kind (Received, Adjusted, Counted, Sold, Returned, Transferred, Consumed), signed Quantity, OnHandAfter, Reason, OrderId, ReferenceType and ReferenceId (what else it was for, such as a work order), LocationId, PurchaseOrderId, actor, Utc |
StockReservation | OrderId, LocationId, Quantity, ReturnedQuantity, Status (Held, Committed, Released), ExpiresUtc |
InventoryPart | TrackInventory (default true), AllowBackorder, LowStockThreshold, ReleaseDateUtc (Ships from, makes a backorder a pre-order) |
StockLocation | A place stock is kept (a CatalogItem; its ItemId is the location id): Name, Address, Position (the order orders take units from), and OwnerKind/OwnerId for a location another record owns, such as a van. StockLocationStore.FindByOwnerAsync finds an owner's location |
InventorySettings | DefaultLowStockThreshold (5), HoldMinutes (60), LowStockNotificationRoles; its old Locations list is moved into the StockLocation store by a migration, and the settings page edits the site's own locations (up to 50) there |
The default location id is InventoryConstants.DefaultLocationId (default). IInventoryLocationService.GetLocationsAsync() lists the site's own locations, then those owned by other records; its IFulfillmentLocationProvider implementation offers only the site's own, so a van never fulfills an order. InventoryProductSynchronizer keeps one stock item per variant (or one per product) in step as products are saved; removed variants and untracked products are archived, never deleted.
IInventoryService| Method | Use |
|---|---|
AdjustAsync(stockItemId, kind, quantity, reason, actor) | Received (positive) or Adjusted (any non-zero); location overload |
SetCountAsync(stockItemId, count, reason, actor) | Records a Counted movement, even when unchanged; location overload |
TransferAsync(stockItemId, fromLocationId, toLocationId, quantity, reason, actor) | Moves available units between locations |
ReceiveAsync(stockItemId, locationId, quantity, purchaseOrderId, reason, actor) | Receives purchase order units |
ReserveAsync(orderId, lines, expiresUtc) | Holds all counted lines or none; returns a StockShortage |
CommitAsync(orderId, lines) | Sells what the order holds, once |
ReleaseAsync(orderId, reason), ReleaseExpiredAsync(take) | Lets holds go |
RestockAsync(orderId, reason, actor) and RestockAsync(orderId, lines, locationId, reason, actor) | Returns sold units, never more than bought |
ConsumeAsync(stockItemId, locationId, quantity, referenceType, referenceId, reason, actor) | Uses units up at a location (such as parts fitted on a work order) with a Consumed movement; refuses more than available (NotEnoughAtLocation) |
RebuildAsync(stockItemId) | Sets OnHand from the movements |
Results are StockChangeResult; errors are NotFound, InvalidQuantity, Busy, NotEnoughAtLocation. An order's units come from one location that has them all (the requested one first, then locations in listed order), otherwise from each in turn.
With Orders on, InventoryOrderEventHandler reserves on Created for HoldMinutes (refusing the order with Only 1 of Mug left. when short), sells on Paid in the checkout's unit of work, releases on Canceled (restocking a paid order when asked), restocks on a full Refunded when asked, re-holds on Lines changed, and restocks returned lines on Returned. ExpiredStockHoldsBackgroundTask releases expired holds every five minutes.
InventoryAvailabilityProvider answers availability across all locations; when a request names a cart, that cart's own holds count as available to it. Uncounted products are left out and can always be bought. With Product Bundles, BundleAvailabilityProvider answers for bundles from their parts.
public sealed class ReorderStockLevelHandler : IStockLevelHandler
{
private readonly ILogger _logger;
public ReorderStockLevelHandler(ILogger<ReorderStockLevelHandler> logger)
{
_logger = logger;
}
public Task ChangedAsync(StockLevelChangedContext context, CancellationToken cancellationToken = default)
{
if (context.RanLow)
{
_logger.LogInformation("Stock for {Sku} is {Available}; reorder it.", context.Item.Sku, context.Item.Available);
}
return Task.CompletedTask;
}
}
Register with services.AddScoped<IStockLevelHandler, ReorderStockLevelHandler>();. ChangedAsync runs when the level (InStock, Low, Out) changed; AvailableChangedAsync (default no-op) when available units changed. The context has PreviousAvailable, PreviousLevel, Level, RanLow, SoldOut and BackInStock. A rolled-back change raises nothing. With Product Feeds on, the built-in ProductFeedStockHandler raises the ProductFeedCache.SignalKey signal when available units change, so feeds (and the AI agent feeds) rebuild with the new availability. Admin buttons that only had a confirm message (such as deleting a purchase order) now ask through the admin confirm dialog.
Built in: low-stock notifications to LowStockNotificationRoles (with Notifications), the Low Stock workflow event LowStockEvent (with Workflows), search record refresh (with Product Listing) and webhooks. The Automation: low stock alert recipe adds a workflow from LowStockEvent to an email.
{
"steps": [
{
"name": "Stock",
"Items": [
{ "Sku": "MUG", "OnHand": 24 },
{ "ContentItemId": "4rgryp179mr10m6yvbt42xym8n", "VariantId": "4ydepe37jp6sn68kq7pvr4dh5d", "OnHand": 5 }
]
}
]
}
The StockLocations step imports the site's own locations (Locations, each with Name, optional Address, Position); a location keeps the ItemId it is given (such as default), and one without an id is matched by name. Run it before Stock and before point of sale Registers. The Stock locations deployment step writes them in order and leaves out locations another module owns.
{
"steps": [
{
"name": "StockLocations",
"Locations": [
{ "ItemId": "default", "Name": "Main warehouse", "Address": "1 Dock Rd", "Position": 1 },
{ "Name": "Downtown store", "Position": 2 }
]
}
]
}
Stock rows match by ContentItemId and VariantId, else by SKU; products named by id that aren't counted yet are synced first. The Stock deployment step exports every non-archived item. Commerce > Inventory exports and imports StockCsv (Sku, Title, ContentItemId, VariantId, OnHand, Reserved, Available, LowStockThreshold), up to 2 MB and 10,000 rows, all or nothing. With Content Transfer, InventoryPart_* columns import policy and counts (Stock, VariantStock such as TEE-S=4; M / Red=2).
StockAlertForm shows on a sold-out product's page; POST stock/alerts records a StockAlert (limited per email and per IP); BackInStockAlertHandler emails waiting requests when BackInStock, through the store's stock-alert email template (StockItem record). Alerts take part in personal data export and erasure.purchase-orders) manages PurchaseOrder records (Number such as PO-261019-K3QZ7, from the Inventory.PurchaseOrder series of the shared INumberSequence, Supplier, LocationId, Currency, Lines with Ordered, Received, UnitCost, Status: Draft, Ordered, PartiallyReceived, Received, Canceled). PurchaseOrderReceiver.ReceiveAsync receives through IInventoryService.ReceiveAsync. Suppliers are not emailed.CrestApps.OrchardCore.Inventory.Api maps GET products/{id}/availability (guests; counts only when low), and staff inventory, inventory/{stockItemId} (ViewInventory) with receive, adjust, count, transfer (ManageInventory, idempotency keys). A collision with a checkout answers 409 concurrency. See the API reference in orchardcore-commerce.
InventoryAdminController, an AdminList) lists items fewest available first, with Low stock, Out of stock and Backordered filters, and each item's movement history and forms.inventory) is opened by ManageInventory without Manage settings.ViewInventory), and the Low Stock and Stock Movements dashboard widgets with Admin Dashboard (see orchardcore-reports).Inventory, permission ViewInventory): StockItems, StockLevels, StockMovements, StockReservations and Locations, plus PurchaseOrders and PurchaseOrderLines (Purchase Orders) and StockAlerts (Back-in-Stock Alerts, never exposing who asked). The InventoryReportBuilderReports recipe adds editable copies of the stock reports. See orchardcore-report-builder.| Permission | Allows | Default roles |
|---|---|---|
ManageInventory | Changing stock, syncing products, Inventory settings, purchase orders; implies ViewInventory | Administrator, Store manager, Warehouse |
ViewInventory | Listing stock and history, viewing purchase orders | Administrator, Store manager, Warehouse, Customer support |
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
orchard-core, inventory-management, stock-tracking, ecommerce, crestapps
/crestapps-orchardcore:orchardcore-inventoryfrom crestapps-orchardcore
npx claudepluginhub crestapps/crestapps.agentskills --plugin crestapps-orchardcore137 skills in this plugin
/orchardcore-accountsSkill for the CrestApps Orchard Core Accounts module (CrestApps.OrchardCore.Accounts) with its Account Members, Account Team, Account E-mail Domains and Account Locations features. Covers the Account type and AccountPart, the account picker and search, IAccountChildTypeRule, account page sections (AccountPageTabs, AddPageSection, Notes), members and IAccountMemberService, account invitations, the account owner and team picked from staff, e-mail domains, locations with a billing location, the account's billing profile and party members, the Accounts recipe and deployment steps, and the admin menu. Use this skill when requests mention accounts, the businesses or households records belong to, an account page tab, members, invitations, owners, domains or locations. Strong matches include AccountPart, AccountPageTabs, IAccountMemberService, IAccountInvitationService, AccountInvitation, AccountTeamPart, AccountEmailDomainsPart, IAccountEmailDomains, AccountLocationsPart and ManageAccountMembers./orchardcore-accounts-b2bSkill for the CrestApps Orchard Core Accounts B2B module (CrestApps.OrchardCore.Accounts.B2B), business selling on an Account content item. Covers B2BAccountPart and B2BAccount, buyers as account members and ship-to addresses as account locations, terms (deposit, net days, credit limit) through the account-terms tender billed to the account, the account's billing profile, purchase order numbers, quotes, price lists through IBuyerPriceProvider, order limits, approvals and budgets, OCI punchout, the account/business page and API, the PriceLists recipe and deployment steps, the B2BAccounts report source, and the move from the removed Companies module. Use this skill when requests mention B2B, wholesale or business buyers, net terms, purchase orders, price lists, order approvals or punchout. Strong matches include B2BAccountPart, B2BAccount, AccountTerms, AccountTermsTenderProvider, B2BAccountBillingProfileSource, IB2BAccountStore, PriceList, B2BPriceProvider, B2BApprovalService and ManageB2BAccounts.Other plugins' skills for the same job