From medusa-commerce
Implements Medusa v2 cart and checkout flows: lifecycle, line items, addresses, shipping/payment selection, sales channels, completion. Use for e-commerce cart building.
npx claudepluginhub orcaqubits/agentic-commerce-skills-plugins --plugin medusa-commerceThis skill is limited to using the following tools:
**Fetch live docs**:
Generates design tokens/docs from CSS/Tailwind/styled-components codebases, audits visual consistency across 10 dimensions, detects AI slop in UI.
Records polished WebM UI demo videos of web apps using Playwright with cursor overlay, natural pacing, and three-phase scripting. Activates for demo, walkthrough, screen recording, or tutorial requests.
Delivers idiomatic Kotlin patterns for null safety, immutability, sealed classes, coroutines, Flows, extensions, DSL builders, and Gradle DSL. Use when writing, reviewing, refactoring, or designing Kotlin code.
Fetch live docs:
site:docs.medusajs.com cart module for cart data model and service methodssite:docs.medusajs.com checkout flow for the end-to-end checkout processsite:docs.medusajs.com sales channel for sales channel scopinghttps://docs.medusajs.com/resources/references/cart and review the ICartModuleService interfacemedusajs v2 cart workflow 2026 for latest cart-related workflow stepsCreate Cart ──> Add Line Items ──> Set Address
──> Select Shipping ──> Init Payment ──> Complete
| State | Description |
|---|---|
| Active | Cart is open, items can be added/removed |
| Completing | Checkout in progress, payment being processed |
| Completed | Cart converted to order, no further modifications |
| Entity | Key Fields |
|---|---|
| Cart | region_id, customer_id, sales_channel_id, email |
| LineItems[] | variant_id, quantity, unit_price, Adjustments[] |
| ShippingMethods[] | shipping_option_id, amount, data |
| Addresses | shipping_address, billing_address |
| PaymentCollection | PaymentSessions[] |
| Link Target | Purpose |
|---|---|
| Product Module | Variant resolution |
| Region Module | Currency, tax rules |
| Sales Channel Module | Storefront scoping |
| Promotion Module | Discount application |
| Payment Module | Payment sessions |
| Fulfillment Module | Shipping methods |
Fetch live docs for cross-module link definitions and
remoteQueryusage for cart enrichment.
// Skeleton: create cart in storefront
// Fetch live docs for createCartWorkflow input
const cart = await createCartWorkflow(container)
.run({ input: { region_id, sales_channel_id } })
// Fetch live docs for required vs optional fields
| Workflow | Purpose |
|---|---|
addToCartWorkflow | Add variant + quantity to cart |
updateLineItemInCartWorkflow | Update quantity of existing item |
deleteLineItemsWorkflow | Remove items from cart |
| Field | Required | Notes |
|---|---|---|
first_name / last_name | Yes | |
address_1 | Yes | Street address |
city | Yes | |
country_code | Yes | ISO 2-letter code |
postal_code | Conditional | Required by region |
province | Conditional | State/province |
Available options determined by cart region, shipping address, and shipping profiles.
| Workflow | Purpose |
|---|---|
listShippingOptionsForCartWorkflow | Fetch available options |
addShippingMethodToCartWorkflow | Apply selected shipping option |
| Workflow | Purpose |
|---|---|
createPaymentCollectionForCartWorkflow | Create payment collection |
initializePaymentSessionWorkflow | Start provider-specific session |
| Workflow | Purpose |
|---|---|
completeCartWorkflow | Convert cart to order |
Completion validates: all items in stock, shipping selected, payment authorized, email set.
Fetch live docs for the exact validation checks performed during cart completion.
| Concept | Description |
|---|---|
| Sales Channel | Named storefront scope (e.g., "Web", "Mobile App", "B2B") |
| Publishable API Key | Associates Store API requests with a sales channel |
| Product-Channel Link | Products published to specific channels |
x-publishable-api-key headerFetch live docs for publishable API key configuration and sales channel management.
| Route Pattern | Method | Purpose |
|---|---|---|
/store/carts | POST | Create cart |
/store/carts/:id | GET | Retrieve cart |
/store/carts/:id | POST | Update cart (email, address) |
/store/carts/:id/line-items | POST | Add line item |
/store/carts/:id/line-items/:item_id | POST/DELETE | Update/remove line item |
/store/carts/:id/shipping-methods | POST | Add shipping method |
/store/carts/:id/payment-collections | POST | Create payment collection |
/store/carts/:id/complete | POST | Complete checkout |
Fetch live docs for request body shapes and response formats on each route.
region_id -- it determines currency, tax rules, and shippingsales_channel_id to scope product availability per storefrontmetadata (e.g., gift messages, notes)remoteQuery to enrich cart data (product details, images) in a single queryFetch the Medusa v2 cart module documentation and checkout workflow references for exact service method signatures, workflow inputs, and validation rules before implementing.