Addons
Product Q&A
Collect shopper questions directly on product pages, moderate them in wp-admin, and show approved answers inline. Everything ships in the free build.
Components
- Frontend block: Injected via
kitbix_commerce_after_product. Layout can be accordion or card. - REST API:
/kitbix-commerce/v1/product-qnahandles submissions,/product-qna/moderationpowers the admin table. - Database: Installer creates the
kitbix_product_qnatable on bootstrap. - Admin UI: Adds “Product Q&A” under Kitbix Commerce with pending counts and moderation actions.
Settings reference
| Field | Key | Description |
|---|---|---|
| Layout Style | layout_style |
Dropdown with “Accordion” and “Card”. Determines markup class names so your theme can target them. |
Submission lifecycle
- A visitor fills the question form (name + email required) rendered by
views/product-qna.php. - JavaScript posts to the REST endpoint with a transient-backed nonce (
createSubmissionToken()). ProductQnaEntry::create()stores the submission inpendingstatus unless a duplicate pending entry exists for the same email/product.- Moderators answer or approve entries from Kitbix Commerce → Product Q&A, which updates status via the moderation REST routes.
- Approved entries render on the product page with relative timestamps supplied by
formatEntries().
Testing checklist
- Enable the addon in Kitbix Commerce → Addons and choose a layout.
- Submit a question as a customer (check browser console for REST errors).
- Approve the question in wp-admin; confirm it flips to “Published” and appears on the product page.
- Switch the layout setting and reload; markup should update without cache clears.
Common pitfalls
- Nonce failures when caching forms aggressively. Regenerate by reloading the product page.
- No email provided → submission rejected with status 422 (handled in UI, but log this when debugging).
- Expecting auto-publish. Every entry starts Pending; add SOPs so support reviews daily.
Reminder: Disabling the addon keeps existing entries in the database. Re-enable later and they’ll display again.