Covers the CrestApps Orchard Core Orders module: checkout-to-order flow, order statuses, refunds, invoices, gift cards, returns, quotes, order emails, and the Orders API. Use when working with Orchard Core commerce orders.
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.
Read when SKILL.md points to them.
Orders (new in CrestApps.OrchardCore 3.0) checks a cart out through the Checkout framework and records what was bought. An order holds lines, not money: the payment, tax, attempts and refunds belong to the checkout session the order names.
| Module | Relationship |
|---|---|
Carts (orchardcore-carts) | Required. The cart is frozen into a draft order. |
Checkout (orchardcore-checkout) | Required. Takes payment, coupons, tenders and tax for the order. |
Payments, Pay Later, Transactions (orchardcore-payments, orchardcore-pay-later, orchardcore-transactions) | Collect and refund the money |
Customers (orchardcore-customers) | Adds the Contact step, links Order.CustomerId, store credit refunds |
Inventory (orchardcore-inventory) | Holds, sells, releases and restocks through order events |
Shipping (orchardcore-shipping) | Adds the Shipping step, Order.Shipping, shipments and FulfillmentStatus |
Taxation (orchardcore-taxation) | Tax lines copied to Order.TaxLines |
Receipts (orchardcore-receipts) | ReceiptSettings brand invoices and packing slips |
Invoicing (orchardcore-invoicing) | Sending a draft order issues an Invoicing invoice (or an estimate for a quote with Invoicing Estimates); an order balance put on the ledger gets an issued invoice |
Payroll (orchardcore-payroll) | With Pay Setup and Staff on, paid orders a staff member made become commission pay inputs |
Fulfillment Partners (orchardcore-fulfillment) | Sends paid orders to outside fulfillment companies; adds a Fulfillment partners card to the order page |
Agentic Commerce (orchardcore-agentic-commerce) | AI agent checkouts become orders on the agent channel; order events become signed updates to the agent platform |
Accounts B2B (CrestApps.OrchardCore.Accounts.B2B) | Orders placed for a business account (Order.AccountId, formerly CompanyId), approvals, account terms |
| Feature ID | Name | Depends on |
|---|---|---|
CrestApps.OrchardCore.Orders | Orders | Commerce, Carts, Checkout, Timeline (CrestApps.OrchardCore.Timeline, the order notes and history), CrestApps.OrchardCore.Resources |
CrestApps.OrchardCore.Orders.GiftCards | Gift Cards | Orders, OrchardCore.Title |
CrestApps.OrchardCore.Orders.Returns | Returns | Orders |
CrestApps.OrchardCore.Orders.Api | Orders API | Orders, Cart API, Checkout API |
CrestApps.OrchardCore.Orders in the web/startup project and enable a payment provider.IOrderEventHandler; never poll order status.IOrderService.CancelAsync, and refund through IOrderOperationsService (Orders.Core), so every handler and ledger stays in step.ICommerceEmailSender so the store's templates, layout and the buyer's culture apply.IOrderService from IServiceProvider inside the handler method to avoid a dependency cycle.{ "steps": [...] }.sealed modifier, except View Models.{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.Orders",
"CrestApps.OrchardCore.Orders.GiftCards",
"CrestApps.OrchardCore.Orders.Returns",
"CrestApps.OrchardCore.Customers",
"CrestApps.OrchardCore.Stripe"
],
"disable": []
}
]
}
IOrderService.CreateFromCartAsync freezes it into a Draft order (product version, title, SKU, price, quantity, tax codes, categories, Order.Culture) and runs CreatedAsync handlers, which may refuse it.Replaced.CheckoutReferenceTypes.Order. OrderCheckoutHandler bills one line per order line.Order.TaxLines), discounts (Order.Discounts, DiscountTotal) and tenders (Order.Tenders); bought lines leave the cart and the confirmation is emailed once.| Status | Meaning |
|---|---|
| Draft | From a cart before checkout, or made by the store for a buyer (Order.Invoice set) |
| Awaiting payment | Checkout started, not completed |
| Paid | Checkout completed |
| Canceled | CancelReason: Replaced, PaymentFailed, CheckoutCanceled, CheckoutExpired, Abandoned, Unavailable, CanceledByStore, Declined (a declined quote), Rejected |
Refunds are tracked beside the status in Order.Refunds, RefundedAmount and RefundStatus (PartiallyRefunded, Refunded). AbandonedOrdersBackgroundTask cancels stale unpaid orders every 15 minutes.
public interface IOrderEventHandler
{
Task CreatedAsync(OrderCreatedContext context, CancellationToken cancellationToken = default);
Task PaidAsync(OrderPaidContext context, CancellationToken cancellationToken = default);
Task CanceledAsync(OrderCanceledContext context, CancellationToken cancellationToken = default);
Task RefundedAsync(OrderRefundedContext context, CancellationToken cancellationToken = default) => Task.CompletedTask;
Task ReturnedAsync(OrderReturnedContext context, CancellationToken cancellationToken = default) => Task.CompletedTask;
Task LinesChangedAsync(OrderLinesChangedContext context, CancellationToken cancellationToken = default) => Task.CompletedTask;
}
| Event | Runs | Notes |
|---|---|---|
CreatedAsync | After the order is made | context.Refuse(message) cancels it as Unavailable; the cart shows the problems |
PaidAsync | In the unit of work that marks it paid | Throwing rolls the completion back for the checkout to retry |
CanceledAsync | On every cancel | context.Restock says whether stock goes back |
RefundedAsync | After a refund is recorded | context.Restock only for a full refund the store asked to restock |
ReturnedAsync | When a return's items arrive | Lines with Restock and LocationId |
LinesChangedAsync | When a draft's lines are replaced | context.Refuse(problem) keeps the old lines |
Derive from OrderEventHandlerBase and override only what you need:
public sealed class GiftWrapOrderHandler : OrderEventHandlerBase
{
private readonly IServiceProvider _serviceProvider;
public GiftWrapOrderHandler(IServiceProvider serviceProvider)
{
_serviceProvider = serviceProvider;
}
public override async Task PaidAsync(OrderPaidContext context, CancellationToken cancellationToken = default)
{
var notes = _serviceProvider.GetRequiredService<IGiftWrapNotes>();
foreach (var line in context.Order.Lines.Where(line => line.Details?.ContainsKey("giftwrap.message") == true))
{
await notes.AddAsync(context.Order, line, cancellationToken);
}
}
}
Register with services.AddScoped<IOrderEventHandler, GiftWrapOrderHandler>();. To give the buyer something a paid order bought (files, a membership) and take it back on a cancel or full refund, derive from OrderGrantHandlerBase and implement GrantAsync(Order, CancellationToken) and RevokeAsync(Order, OrderRevokeReason, CancellationToken). When the grant comes from a content part on the product, derive from OrderLineGrantHandlerBase<TPart> instead and implement GetGrantedLineIdsAsync, GrantLineAsync and RevokeLineAsync: it reads each line's product version through IContentManager.GetPurchasedAsync(line) (OrderLine.ContentItemVersionId), so the grant is what was bought even after the product is edited, and it skips lines already granted. Any code that reads a line's product after payment should use GetPurchasedAsync too. After a partial refund the buyer keeps what they bought.
IOrderOperationsService (Orders.Core, implemented by the Orders feature's OrderOperationsService; permission ManageOrders) backs the order page and the staff API, and is how other modules act on orders (Point of Sale refunds a till return through it). OrderOperationResult, OrderMoney and OrderPermissions are in Orders.Core too:
ICheckoutRefundService (newest first), Pay Later through ITransactionCommandService.RefundAsync, then balances (gift card, store credit, points) through ICheckoutTenderLedger.ReturnAsync. With asStoreCredit, the amount goes to the buyer through IOrderStoreCreditRefunder instead.CanceledByStore, optionally refunding everything and restocking.ITimelineService, subject RecordRef(OrderConstants.RecordKind, order.ItemId), record kind Order): write them with IOrderService.AddNoteAsync(order, text, OrderNoteKind, authorName). Order.Notes is [Obsolete]; on upgrade the OrderNotesStep resumable step (and OrderNotesUpgrade) moves stored notes to internal timeline entries in the background, a few batches a minute, idempotently. The staff API still returns every note oldest first, read from the timeline. Buttons that only had a confirm message (cancel, refund, delete) now ask through the admin confirm dialog.Orders are a record kind (OrderConstants.RecordKind, Order, through OrderRecordSource), so other modules (Tickets, Invoicing, the Timeline) link to and pick orders without referencing Orders.
Refunds started anywhere are recorded on the order by OrderRefundRecorder (an IPaymentRefundHandler). Gateway disputes land in Order.Disputes and payment risk in Order.PaymentRisk.
Orders build the order with IDisplayManager<Order> in OrderConstants.DisplayTypes.DetailAdmin (admin and My Orders) and Detail (guest and account). Add a section with a DisplayDriver<Order>:
public sealed class GiftWrapOrderDisplayDriver : DisplayDriver<Order>
{
public override IDisplayResult Display(Order order, BuildDisplayContext context)
=> Initialize<GiftWrapOrderViewModel>("GiftWrapOrder", model => model.OrderId = order.ItemId)
.Location(OrderConstants.DisplayTypes.DetailAdmin, "Content:20");
}
services.AddCommerceEmailSender()
.AddCommerceEmailKind(
"giftwrap-sent",
LocalizationSource.Create<Startup>("Gift wrapped"),
LocalizationSource.Create<Startup>("{{ Message }}: the gift message."));
ICommerceEmailSender, AddCommerceEmailKind, CommerceEmail and ICommerceEmailTemplates moved to Commerce.Abstractions (namespace CrestApps.OrchardCore.Commerce.Emails); AddCommerceEmailSender() and LiquidCommerceEmailTemplates are in Commerce.Core. A CommerceEmail carries Kind, To, Models (the records the template reads by name; pass OrderEmailModels.For(order) so the template reads {{ Order }}), Culture and Reference. The sender renders in the buyer's culture, applies the store's Liquid template and layout for its kind (Settings > Commerce > Emails), sends it, and returns false instead of throwing on failure. Orders registers order-confirmation, order-invoice, order-quote and checkout-recovery; payment reminders, receipts, refund notices and installment plan notices sent through ICustomerOwnerNotifier use the same templates. Add a section to the confirmation email with IOrderEmailSectionProvider.
IOrderLinkService signs a 60-day link (orders/view/{token}) opened read-only, with a pay link while something is owed.orders/find emails a guest their order links; orders/track finds an order by number and email. Both are rate limited (find-order group).account/orders and account/orders/{orderId} show the signed-in user's orders; a guest's confirmation can create an account from the order's email.OrderQuery.AccountId, ManageOrders). The business storefront routes are account/business and checkout/{id}/business (formerly .../company), and ApiOrder.accountId replaces companyId.OrderSettings): SendConfirmations, SendRecoveryEmails with RecoveryDelayHours, AllowQuoteRequests, and the order bump (OrderBumpProductId, OrderBumpPercentOff, OrderBumpHeadline).Drafts and quotes, invoices and packing slips, gift cards, returns, sales channels, reports, workflow events and automation recipes are in references/order-features.md.
CrestApps.OrchardCore.Orders.Api maps POST checkout (checks the caller's cart out, holds stock, returns X-Checkout-Token), me/orders, me/orders/{orderId}, returns under it (with Returns), me/quotes, checkout/{id}/gift-cards (with Gift Cards) and the staff orders endpoints (list, get, by number, refund, cancel) with ManageOrders. ApiOrder carries channel, culture, grouped taxes and notes (read from the order's timeline). See the API reference in orchardcore-commerce.
With Payroll's Pay Setup and Staff on, OrderCommissionPayInputSource (source kind Order, PayrollStartup) gives payroll each paid order's commission: the CommissionRate of the staff member who made it (StaffUserId) times the subtotal less discounts and refunds, on the day it was paid in the site's zone. A run that takes it stamps the order (OrderCommissionPayroll) so it is paid once; a void gives it back; a refund after the commission was paid does not take it back.
With Data Pipelines Core (OrchardCore.DataPipelines.Core) on, as the Report Builder does, Orders registers the Orders data source (Orders). The main date is when the order was placed; filter or group on PaidUtc for payments. Street lines, phone numbers, notes and gift card codes are never exposed. The Reports: store reports to adapt recipe (CommerceReportBuilderReports) adds editable copies of the built-in sales, tax, discount, refund, dispute and orders-to-ship reports to the Store report group. See orchardcore-report-builder.
| Data set | One row per | Feature | Permission |
|---|---|---|---|
Orders | Order, drafts and quotes included | Orders | ManageOrders |
OrderLines, OrderRefunds, OrderDisputes, OrderDiscounts, OrderTaxes | Line, refund, dispute, discount or tax of an order | Orders | ManageOrders |
Returns | Return | Returns | ManageOrders |
GiftCards | Gift card | Gift Cards | ManageGiftCards |
| Permission | Default roles | Allows |
|---|---|---|
ManageOrders | Administrator, Store manager, Customer support | Orders, drafts, invoices, packing slips, returns, order settings and reports |
ViewOwnOrders | Authenticated | My Orders and the account order pages |
ManageGiftCards | Administrator, Store manager | Commerce > Gift Cards |
What SKILL.md sets; muted values are Claude Code's defaults
/crestapps-orchardcore:orchardcore-ordersfrom 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