Provides guidance on the CrestApps Orchard Core Carts module: guest carts, line re-pricing via IProductSnapshotResolver/ICartService, cart shapes, wishlists, and the Cart API with X-Cart-Token.
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.
Carts (new in CrestApps.OrchardCore 3.0) lets visitors put products sold online in a cart from listing cards and product pages. A cart stores what was chosen (product, price, variant, quantity, add-ons, details) and never a price from the browser; every line is priced again whenever it is shown.
| Module | Relationship |
|---|---|
Commerce, Products (orchardcore-commerce, orchardcore-products) | Required. Products supplies prices, variants, add-ons and availability. |
Orders (orchardcore-orders) | Adds Checkout to the cart and turns it into an order |
Checkout (orchardcore-checkout) | Takes the order's payment |
Inventory (orchardcore-inventory) | Caps quantities and refuses sold-out lines |
Markets (orchardcore-markets) | Prices the cart in the shopper's currency and refuses restricted products |
| Feature ID | Name | Depends on |
|---|---|---|
CrestApps.OrchardCore.Carts | Carts | Commerce, Products, OrchardCore.Contents |
CrestApps.OrchardCore.Carts.Wishlists | Wishlists | Carts |
CrestApps.OrchardCore.Carts.Api | Cart API | Carts |
CrestApps.OrchardCore.Carts in the web/startup project, and enable Orders to check carts out.ICartService to add, update and price lines; never write a cart document directly.giftwrap.message.{ "steps": [...] }.sealed modifier, except View Models.{
"steps": [
{
"name": "Feature",
"enable": [
"CrestApps.OrchardCore.Carts",
"CrestApps.OrchardCore.Carts.Wishlists",
"CrestApps.OrchardCore.Orders"
],
"disable": []
}
]
}
A product that can be bought online at a one-time price. The cart refuses listing-only or unpriced products, subscription plans and recurring prices, buyer-named amounts, products that can't be converted into the cart's currency, products an IProductSaleRestriction forbids, quantities the price or quantity rules don't allow, and products with a part in CartOptions.ExcludedParts. A line whose product was unpublished, taken off sale or repriced is flagged, and the cart can't check out until it changes.
| Visitor | Found by |
|---|---|
| Signed in | User id |
| Guest | cart_owner cookie with a protected token; only its hash is stored. Issued on first add. |
Signing in merges the guest cart into the user's (same product and price add up; lines in another currency are dropped). Carts live in the Carts YesSql collection and expire after 30 days (guest) or 90 days (user) without changes; an hourly task deletes them.
public sealed class Startup : StartupBase
{
public override void ConfigureServices(IServiceCollection services)
{
services.Configure<CartOptions>(options =>
{
options.GuestCartLifetime = TimeSpan.FromDays(14);
options.UserCartLifetime = TimeSpan.FromDays(60);
options.MaxLines = 50;
options.MaxQuantity = 20;
options.ExcludedParts.Add("MembershipPart");
options.ChooseOnProductPageParts.Add("GiftWrapPart");
});
}
}
ExcludedParts holds SubscriptionPart by default. ChooseOnProductPageParts makes cards link to the product page instead of adding, for products whose line needs details.
ICartLineHandlerHandlers run by Order, lowest first; product add-ons are the first handler (order 100). PrepareAsync keeps the details it owns from PostedDetails (anything no handler keeps is dropped) or calls Refuse. EvaluateAsync prices the line: change UnitPrice, lower MaxQuantity (with MaxQuantityReason, a LocalizedString the shopper is told instead of Only N left, such as A course is for one person), set PeoplePerUnit, add CartLineDetails, set Problem, or set ExcludeFromDiscounts. ConvertAsync converts from the product's currency into the line's.
public sealed class GiftWrapLineHandler : ICartLineHandler
{
private const string Detail = "giftwrap.message";
public int Order => 200;
public Task PrepareAsync(CartLinePrepareContext context, CancellationToken cancellationToken = default)
{
if (context.PostedDetails.TryGetValue(Detail, out var message) && !string.IsNullOrWhiteSpace(message))
{
context.Details[Detail] = message.Trim();
}
return Task.CompletedTask;
}
public async Task EvaluateAsync(CartLineEvaluateContext context, CancellationToken cancellationToken = default)
{
if (context.GetDetail(Detail) is not { } message)
{
return;
}
context.UnitPrice += await context.ConvertAsync(3m, cancellationToken);
context.Details.Add(new CartLineDetail(Detail, "Gift wrapped", message));
}
}
Register with services.AddScoped<ICartLineHandler, GiftWrapLineHandler>();. The Add to cart form posts details as details[giftwrap.message] (a field outside the form uses form="add-to-cart-{contentItemId}"); the Cart API posts details. Details are copied to OrderLine.Details and their descriptions to OrderLine.DetailLines. Two lines of the same product with different details stay apart.
public sealed class SaveForLaterCartActionProvider : ICartActionProvider
{
public Task<IReadOnlyList<CartAction>> GetActionsAsync(CartPricing pricing, CancellationToken cancellationToken = default)
=> Task.FromResult<IReadOnlyList<CartAction>>([new CartAction("Email me this cart", "/cart/email", "We'll send you a link to it.")]);
}
Buttons render under Checkout; Orders' QuoteCartActionProvider adds Request a quote this way.
| Shape | Where |
|---|---|
AddToCart | Actions zone of the product's ProductAction display (cards and pages); shows availability and the variant picker |
Cart | /cart (CartController) |
CartLink | The Navbar shape (TheTheme and the Storefront theme render it); also hosts the mini cart |
MiniCart | Offcanvas loaded from GET cart/mini (route CartMini) |
GroupedProducts | Grouped products' quantities, posted to cart/add-many |
Forms are plain antiforgery POSTs (POST cart/add, cart/update, cart/remove) that redirect back with a notification; with Accept: application/json they answer { succeeded, message, itemCount }. They are in the Cart rate-limit group of OrchardCore.RateLimits (see orchardcore-rate-limits). Override any shape in Razor or Liquid; an empty CartLink template hides the cart link. The product-variant-picker script turns the variant list into one select per option.
CrestApps.OrchardCore.Carts.Wishlists keeps a Wishlist per signed-in user (up to 100, WishlistIndex). WishlistButton posts to wishlist/{contentItemId}/add or /remove; account/wishlist lists saved products with their add to cart and adds Wishlist to the account menu.
With Data Pipelines Core (OrchardCore.DataPipelines.Core) on, as the Report Builder does, Carts registers the Carts data source (Carts): Carts and CartLines (open carts and their product lines), and with Wishlists Wishlists and WishlistItems. Every data set needs ManageOrders (Carts has no screens of its own). The indexes hold no dates, so there is no main date; the guest cart token and typed line details are never exposed. An order's CartId joins its cart. See orchardcore-report-builder.
CrestApps.OrchardCore.Carts.Api maps into api/commerce/v1:
| Method | Path | Who |
|---|---|---|
GET | cart | Guest |
POST | cart/lines (productId, variantId, priceId, quantity, addOns, details) | Guest |
PATCH | cart/lines/{lineId} (quantity; zero removes) | Guest |
DELETE | cart/lines/{lineId}, cart | Guest |
POST | cart/merge (bearer token plus the guest's X-Cart-Token) | Buyer |
The answer that creates a guest cart carries X-Cart-Token; send it on every cart call and on POST checkout (Orders API). A restricted product answers 409 not-available. See the API reference in orchardcore-commerce.
Saved carts, recurring prices in carts and editing a paid order's lines. Checkout belongs to Orders.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
orchard-core, ecommerce, shopping-cart, wishlist, headless-cart
/crestapps-orchardcore:orchardcore-cartsfrom 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