KahunaCart documentation
Native ecommerce for Grav 2.0 — products, cart, checkout, orders, digital delivery, and a payment-provider ecosystem.
Requirements, installation, your first product, and your first sale with the built-in offline provider.
Products, product types, variants, categories, the catalog index, and the customer-facing storefront.
Tax engines, shipping zones, coupons, automatic sales, price lists and quantity tiers, store credit and gift cards, selling in more than one currency, and the minor-unit conventions behind every amount.
Stripe, Polar, PayPal and offline payment, custom checkout options for each provider, plus digital downloads, versioned releases, license keys, subscriptions and catalog sync.
The admin, order statuses and staged order changes, customers and retention, the CLI, reports and analytics, dashboard alerts, the CSV importer, exporting and restoring the whole store, emails, hardening a production store, and troubleshooting.
Email marketing run from your own store: subscribers with a consent record, lists, segments, campaigns, automations, deliverability and provider delivery reports. Add-on.
The provider contract, a guide to building a provider, adding your own admin screen, and the REST API for integrators.
Run your store from an AI assistant with grav-mcp, and let AI shopping agents in Google AI Mode, Gemini, ChatGPT and MCP clients find and buy your products.
Read in this order
Get running
- Getting started — requirements, install, your first product, and a test order with the built-in offline provider.
- Configuration — every config key with its default, database options, and the route cache.
Build the store
- Products and catalog — products, product types, variants, stock, priced add-on options, catalog order and featured products, categories, tags, attributes, related products, images, and downloadable files.
- Storefront — routes, template overrides, Twig functions, search and its three engines, instant filters, pagination, sectioned listings, SEO output, and the checkout flow.
- Shortcodes — put a product grid, a buy button or a gallery into an ordinary page's Markdown, with no Twig in content and no theme change.
- The catalog index — the index behind every listing, facet count, sort and ranked search, when queries use it, and how to rebuild it.
- Customer accounts — the account area, store accounts, invoices, and the address book.
- Address validation — the optional address check at checkout, with Google or Mapbox.
- Theming — the
--kahunacart-*custom properties and CSS class reference.- Theme blocks — change a storefront page's markup by extending it instead of copying it.
- Multilanguage — translated catalog text and language-prefixed routes. Skip on a single-language store.
Get the money right
- Tax — flat rate or zones, tax classes, inclusive pricing, and the EU VAT preset.
- Shipping — flat rate or zones, methods, shipping classes, and free-shipping thresholds.
- Coupons — coupon types, the discount basis, stacking, campaigns and bulk code generation, the restriction matrix, and conditions that keep a code to a customer group or to a cart that holds a given product.
- Sales — automatic scheduled discounts, rule precedence, quantity tiers, the storefront badge, and how sales interact with coupons.
- Price lists and quantity tiers — quantity discounts, price lists, customer eligibility rules, the selection algorithm, and current storefront support.
- Rules and conditions — the operations a discount prices through, the condition vocabulary, buy-one-get-one, and registering your own.
- Money conventions — every amount is stored in minor units, and how a per-line refund is allocated.
- Currencies: sell in more than one currency: the settings, typing a price in each or converting from the base price, exchange rates, how the shopper's currency is chosen, what a missing amount does, switching with a cart open, reports, caching and the add-ons.
- Selling through more than one company: a company per currency, with its own invoice and credit-note books and its own payment account.
- Store credit, gift cards and credit notes — one append-only ledger with the balance summed and never stored, gift cards on top of it, spending credit at checkout, refunding to credit, and the numbered credit note every confirmed refund earns.
Sell and deliver
- Payment providers — Stripe, Polar, PayPal, and the offline provider.
- Payment methods — several checkout options for one gateway: labels, logos, instructions, a taxed fee, and conditions that decide when each is offered.
- Digital products — files, download grants, delivery methods, and refunds.
- Product releases — versioned builds, publishing from CI, and who gets which version.
- Licenses — license keys, seats, updates windows, renewals, and the public validation API. Add-on.
- Catalog sync — keeping a provider's catalog in step with yours.
- Subscriptions — plans, billing modes, trials, renewal orders, and the customer and admin screens. Add-on.
Run it
- Orders and the admin — order status, the indexed order search, order history and notes, shipments and packing slips, refunds, bulk actions, the configurable export, and quotes.
- Order statuses — the three configurable status categories, the flags used by reports and add-ons, and how to add or rename a status.
- Order changes — editing a placed order by staging a change and confirming it, the version that keeps every earlier state readable, returns including damaged units, and the audited unlock.
- Customers, wishlists, reviews and retention — customer groups and the codes used in rules, named wishlists, reviews with a computed verified badge, the four-window retention schedule, and reassigning or erasing a customer.
- CLI — every
bin/plugin kahunacartcommand. - Reports and the rollup — the daily rollup the sales reports read, when its numbers are exact, and how to rebuild it.
- Analytics — comparison periods, published metric definitions, filters and breakdowns, where an order came from, and cost of goods and margin.
- Dashboard alerts — the strip at the top of the admin, the four checks that ship, hiding one, and registering your own.
- Importing — the CSV importer for products, variants, categories, customers and orders, with saved mappings, dry runs, resumable runs and error reports.
- Export and restore — the whole store in one zip and back: what a bundle holds and leaves out, customer password hashes and the keys sealed with a passphrase, full restore or merge, the dry run and the report, and moving a shop to a site of its own.
- Emails — the sixteen customer emails, resending one, and how to override their templates.
- Object templates — editable Twig templates for SKUs, line titles, the order reference, invoice file names and email subjects.
- Notifications — get told about your store by email, Slack, Discord, Telegram, Pushover, ntfy, Gotify, text message or a webhook.
- Hardening — web-server rules for the data directories, expiring order links, rate limits, trusted proxies, and reporting a vulnerability.
- Troubleshooting — symptoms, causes, and fixes.
- Benchmarking — seed a quarter of a million orders and time the queries behind the storefront and the admin.
- Performance — PHP-FPM, opcache and database settings for production, and where to start investigating slow performance.
Mail the list
- Newsletters — what the add-on is, what it needs, and the ten screens it adds to the admin.
- Getting started with the newsletter — install, the From address, the first list, the signup form and the first campaign.
- Subscribers, lists and tags — consent and confirmation, the five statuses, the preference centre, suppressions, and CSV import and export.
- Segments — saved filters for your audience, the condition vocabulary, and how counts refresh.
- Campaigns — writing, previewing, testing, scheduling, A/B subject tests, UTM tagging, and where each number comes from.
- Automations — the ten triggers, the six kinds of step, the three recipes, and how steps run once per minute.
- Reports — seven reports over a date range: campaign performance, list growth, engagement, links, bounces and complaints, automations and send times.
- Health — the nine deliverability checks over your domain, your transport and the last thirty days of sending.
- Delivery reports and providers — the provider webhook, what the store does with each event, and how reports are matched to messages.
- Settings reference — every newsletter config key with its default.
- Newsletters for developers — the storefront routes, the admin API, the events, the Twig function and the two registries.
Automate it
- Run the store from an AI assistant — connect grav-mcp, check the connection, and every KahunaCart tool an assistant can call.
Sell through AI agents
- Agentic commerce — the four parts that let AI shopping agents find and buy from the store, what an agent can and cannot do, and the setup checklist for Google AI Mode and Gemini, ChatGPT and MCP clients.
- Product feeds — the Google Merchant Center and OpenAI feeds: which products are rows, every field, and when the files are built.
- Storefront MCP — the public MCP server at
{base}/mcpand its thirteen tools. - UCP checkout — native checkout for Google's agents: the profile, sessions, Google Pay with Stripe, the
continue_urlhandoff and signed order webhooks.
Extending KahunaCart
- Provider contract — the specification a payment provider plugin implements.
- Provider developer guide — build a provider plugin step by step.
- Admin sections — add your own screen to the KahunaCart admin.
- REST API — authentication, conventions, permissions and every endpoint, for integrators and CI pipelines.
- Events — every event the base plugin, Licenses and Subscriptions fire, with their payloads.
- Twig functions and filters — the storefront's Twig helpers with their signatures.
- Shortcodes — the six storefront blocks a page's Markdown can carry: a product grid, a buy button, a gallery, no Twig in content.
- Signed links and rate limits — order links, tokens, the rate-limit buckets and trusted proxies from a developer's side.
- Extension zones — the named locations where add-ons can display widgets in the admin and storefront.
- Storefront JSON API — the public JSON endpoints beside the HTML pages, for a headless front end.
- Outbound webhooks — subscriptions that tell another system when something happens here.
- Translating KahunaCart — translating the plugin, and how to submit a pack.
- Custom fields and the settings store — typed fields on a record, and the namespaced settings tier an add-on stores its own keys in.
- Publish your plugin's tools to an AI assistant — describe your own routes in an
mcp.yamlmanifest.
Quick reference
| Storefront base route | /shop (config key route); /de/shop on a multilanguage site |
| Webhook URL | {site}/shop/webhook/{provider-slug} |
| Database | user/data/kahunacart/db/kahunacart.sqlite |
| Downloadable files | user/data/kahunacart/files |
| Product images | user/images/kahunacart/products |
| Category images | user/images/kahunacart/categories |
| Product search | {site}/shop/search?q= |
| Rebuild the order search | bin/plugin kahunacart orders:reindex |
| Rebuild the report rollup | bin/plugin kahunacart reports:rebuild |
| Run the retention sweep | bin/plugin kahunacart retention:run --dry-run |
| Export orders | bin/plugin kahunacart export --orders orders.csv |
| Export the whole store | bin/plugin kahunacart export --bundle=store.zip |
| Filtered listing | {site}/shop?tag[]=organic&attr[material]=cotton&min=10&stock=1&sale=1 |
| Customer account area | {site}/shop/account (needs the Login plugin) |
| Admin | Sidebar → KahunaCart (/plugin/kahunacart) |
| Health check | bin/plugin kahunacart status |
| After a plugin update | bin/grav clear-cache |
| Product feeds | {site}/shop/feeds/google.tsv, google-checkout.tsv, openai.jsonl.gz (feeds.enabled) |
| Storefront MCP endpoint | {site}/shop/mcp (storefront_mcp.enabled) |
| UCP business profile | {site}/.well-known/ucp (ucp.enabled) |
| Agent readiness | Admin → Agentic commerce, or bin/plugin kahunacart check |
Known limitations
Each limitation below is also described on the relevant guide page.
- A currency no rate source lists needs a rate you type. The European Central Bank lists about thirty currencies, and Frankfurter, which is asked for the rest by default, lists more than 160. For a currency neither lists, type the rate on the Currencies screen or use a source from an add-on. A currency set to convert with no rate stays unpriced. See Currencies.
- Catalog sync creates the default variant only. Extra variants are recorded in the mapping row, not created at the provider. See Catalog sync.
- An unallocated partial refund reverses nothing. A refund that names its lines restocks them and revokes their downloads; a refund that is only an amount cannot tell which items the money was for. See Orders and the admin.
- A shipment cannot be deleted or voided. Recording one is the only write, and an under-shipment is corrected by shipping the remainder. Shipment records and download revocations cannot be reversed. See Orders and the admin.
- A merchant-of-record provider charges no local tax. This is decided when the customer picks the payment method, so the cart page still shows the local estimate. See Tax.
- Stripe ships hosted Checkout only. On-site Elements is planned for a later phase.
- Returns have no exchanges yet. A customer who wants a different size returns the first one and places a new order. See Returns.
- A status you add cannot mean "the payment was refused". The registry has no column for it, so a second refused-payment status is swept by the trash pending retention rule rather than the failed one. See The retention schedule.
- An imported order records no adjustments, taxes or shipping lines. The file's own total is stored as authoritative, so an imported order's totals need not add up from its lines. See Importing.
- Only Stripe charges Google Pay for an agent. Every other provider, PayPal included, sells to agents through the
continue_urlhandoff to your own checkout. PayPal's Google Pay support is planned for a later phase. See UCP checkout. - ChatGPT's in-chat checkout (ACP) is not built. OpenAI dropped in-chat checkout in March 2026. The OpenAI product feed is built, and a ChatGPT buyer buys on your product page. See Agentic commerce.