# Ecommerce FAQ API in Go (GoCommerce module)

> Give a GoCommerce store a page of questions and answers: grouped into sections, ordered by hand, draft or published, served whole at /x/faq.

- Canonical: https://kitcommerce.store/integrations/faq/
- Last updated: 2026-10-30

---

Platform

## Ecommerce FAQ API in Go

A Go package that holds the questions a shop is asked often, and its answers. Operators write them on the admin’s FAQ screen, group them into sections they name, and drag them into order. The storefront reads the whole published set at /x/faq.

- **Platform** module
- **2** settings
- **3** tests
- **6** API operations
- **ext/faq**

### What it does

In the package’s words, every storefront has a page of these and every shop writes the same ones, “where is my order, how do I return this, what does delivery cost”, so the engine gives the answers a table, the panel a screen, and the storefront one address to read them from.

An entry is a question, an answer, a section such as “Delivery” or “Returns”, a position within that section, and a published flag. An entry with no section belongs to the ungrouped set, which the storefront shows first. A question with no answer is refused: in the module’s words, “an unanswered question helps nobody”.

GET /x/faq answers with the page’s heading, the line under it, and the published entries grouped by section, each with its id, question and answer. The storefront gets no positions or timestamps, because the order is the order the entries arrive in.

### Configuration

Two settings, both optional. The heading can be set in Config or on the Plugins screen, which wins; the line under it is set on the Plugins screen only.

*FAQ module settings — 2 settings, 0 required*

| Setting | Environment variable | Required | What it does |
| --- | --- | --- | --- |
| `Heading` Page heading | — | No | What the storefront’s page is called. “Frequently asked questions” when empty. A value in Config becomes the panel field’s default. |
| `blurb` Line under the heading | — | No | A line the storefront shows under the heading. Panel only; there is no Config field for it. |

The module reads its Config struct, not the environment. The variable names are the ones the package’s own example or the reference binary uses; in your own `main()` you choose where each value comes from. Where a setting has a panel label, the admin’s settings drawer can hold it too, and a value typed there wins over Config.

### Setting it up

1. **Install the module** — Pass faq.New to gocommerce.New, as below, or start the reference binary with -faq. The FAQ plugin starts switched on.
2. **Write the questions** — On the FAQ screen, or POST /api/admin/x/faq with a question, an answer and a section. An entry is published unless the request says published is false.
3. **Put them in order** — Drag them on the FAQ screen, which saves the whole list with PUT /api/admin/x/faq/order: every entry’s id and section, in the order they should read.
4. **Read them from the storefront** — GET /x/faq answers with the heading, the line under it, and the published entries grouped by section.

main.go

```
import (
	"github.com/itswadesh/gocommerce/core"
	"github.com/itswadesh/gocommerce/ext/faq"
)

app, err := gocommerce.New(cfg, faq.New(faq.Config{}))
```

The package doc’s own example, with its imports; cfg is your gocommerce.Config. The reference binary’s -faq flag and examples/store/main.go install it the same way. Import path `github.com/itswadesh/gocommerce/ext/faq`.

### How it works

- **Ordered by hand**

  A new entry goes last in its own section, not last overall, which is where it belongs until somebody drags it. Within a section the order is the shop’s, never the alphabet’s.

- **The whole order at once**

  A reorder names every entry with the section it now belongs to, the way the Menus screen saves a tree. One that leaves an entry out, or names one the store does not hold, is refused whole in one transaction: a half-sorted list is worse than one that did not move.

- **Drafts stay in the admin**

  An entry saved with published false is on the FAQ screen and the admin list, and absent from /x/faq until it is published.

- **The switch gates the storefront only**

  With the FAQ plugin off, GET /x/faq answers 404, “this store has no FAQ”. The admin routes still answer, because the screen is where it is switched back on.

- **Rights of its own**

  Seeing the FAQ in the admin needs faq.read, held by managers and staff by default. Writing, ordering and removing entries need faq.write, held by managers.

- **Sample questions**

  The sample shop adds five questions in Orders, Delivery and Returns. A question the shop already asks is skipped, and erasing the sample shop removes only the entries it added.

### What it does not do

Read these before an order depends on it. No store is known to run GoCommerce in production yet, so these come from the code, not from anyone’s experience.

- **Sections sort by name** — Entries are read sorted by section, then position, so sections reach the storefront in alphabetical order, the ungrouped set first. The reorder sets the order within each section; it does not store an order for the sections themselves.
- **One language** — An entry has no language. A store selling in several languages gets one FAQ, in whatever language it was written.
- **An update rewrites the entry** — PATCH /api/admin/x/faq/{id} takes the question, the answer and the section every time. A request that leaves out published publishes the entry, and a changed section keeps the old position, so place it with a reorder.
- **Length is counted in bytes** — A question is at most 300 and an answer at most 8,000, counted in bytes. Text in a script that takes several bytes a character, such as Devanagari, reaches the limit sooner.
- **Plain text, all at once** — The answer is text from a textarea, stored and served as written; the module does not render or clean it. Every entry is returned in one response, with no paging.

FAQ

### Questions about the FAQ module

**What does the storefront get from /x/faq?**

One response with heading, blurb and sections. Each section has its name and its published entries, each with an id, a question and an answer, in the order the shop arranged them within the section.

**Can I hide the FAQ without deleting it?**

Yes. Switch the FAQ plugin off on the Plugins screen and /x/faq answers 404; the entries stay and the FAQ screen still works. A single entry can be hidden by saving it with published off.

**Can I have an FAQ in each language?**

No. Entries carry no language, so the store has one FAQ. The cms module’s content pages are the ones that keep a copy per language.

**Who can edit the FAQ?**

An operator with faq.write, which managers hold by default; an owner holds every right. Staff hold faq.read and can see the entries but not change them. Either right can be granted to another role on the Roles screen.

### Related modules

Each is a directory under `ext/`, imported the same way. Where this one fits in the store: [How modules extend GoCommerce](https://kitcommerce.store/features/development/).

- [Customer accounts and login in Go Add shopper accounts to a GoCommerce store: sign-up, sign-in, saved addresses, password reset and order history by claim. Guest checkout keeps working.](https://kitcommerce.store/integrations/identity/)
- [Order and GST tax invoices in Go A numbered invoice for every paid GoCommerce order and, for Indian stores, a GST tax invoice with HSN codes and the tax split, exported to TallyPrime.](https://kitcommerce.store/integrations/invoices/)
- [Open-source ecommerce MCP server in Go Let an AI agent operate a GoCommerce store over the Model Context Protocol: 19 tools, per-tool rights, read-only agent keys, a read-only mode and an audit log.](https://kitcommerce.store/integrations/mcp/)
- [Storefront menus API in Go Keep a GoCommerce storefront’s menus as trees of links by handle, saved whole, resolved to storefront paths, and moved in and out as a CSV file.](https://kitcommerce.store/integrations/navigation/)

### Source

Everything on this page is read from [`ext/faq`](https://github.com/itswadesh/gocommerce/tree/main/ext/faq) in the GoCommerce repository, MIT licensed. When this page and the code disagree, the code is right and this page is out of date.

- [ext/faq on GitHub](https://github.com/itswadesh/gocommerce/tree/main/ext/faq)
- [All GoCommerce modules](https://kitcommerce.store/integrations/)

### Try it against a store of your own

The backend + admin quick start runs GoCommerce’s API and admin on your own machine, without a storefront. Add this module to it and try it on test orders before a real one depends on it.

[Backend + admin quick start](https://kitcommerce.store/#one-command) · [Read the module](https://github.com/itswadesh/gocommerce/tree/main/ext/faq) · [All integrations](https://kitcommerce.store/integrations/)
