Skip to main content

Product Questions & Answers

Goal​

Let shoppers ask a question on a product page and let the shop — or other customers — answer it. Questions and answers are held in the plugin's own tables rather than as WordPress comments, pass through a moderation queue, and can be voted on.

Tier and entitlement​

FieldValue
TierPremium
Entitlement keyqa
Admin tabproduct-qa
Module keyqa
Settings prefixaiowc_qa_

Hooks register only when aiowc_module_enabled_qa is true and the licence permits the qa entitlement.

What the code does​

  • A question form and the question list render below the product summary on the single product page, and the same list is available anywhere through a shortcode.
  • Guests may ask a question when allow_guest_questions is on, supplying a name and email address. Signed-in users are identified by their account.
  • New questions and answers land as pending when require_approval is on, and are only shown once approved.
  • Moderation moves an item to approved, rejected or spam. The same three transitions exist for both questions and answers, selected by the type argument.
  • Voting is recorded in its own table against either a question or an answer.
  • A daily job notifies the shop about questions that are still unanswered.
  • Answers submitted through the REST API require a signed-in user; questions do not.

Settings​

Read through ModuleSettings with the aiowc_qa_ prefix; defaults are QaModule::DEFAULTS.

SettingDefaultMeaningConsumed
allow_guest_questionstrueWhether a signed-out visitor may askYes — the product form and the ask service
require_approvaltrueWhether new questions and answers start as pendingYes — the question and answer services
notify_admintrueWhether the shop is emailed about new activityYes — the notification service
enable_shortcodetrueWhether [aiowc_qa] is registered at allYes — checked before add_shortcode
enable_votingtrueIntended to switch voting offNo — the key is declared but never read, so voting is always available

The settings are editable from the Settings tab on the Product Q&A screen, over GET and PATCH/POST/PUT on /qa/settings (administrator-only). ⚠️ An earlier version of this page said there was no endpoint and that the values could only be changed through the option row; that route was added on 2026-09-14.

🔴 A route is not the same as an effect. enable_voting above is still declared and never read, so turning it off in the new form changes the stored value and not the behaviour. That is tracked separately.

Admin screen​

Admin tab product-qa. Two tabs — Questions and Answers — both showing the pending moderation queue with approve, reject and spam actions, backed by the moderation endpoints below. The screen carries no settings form, matching the absence of a settings endpoint.

Database schema​

Created by Schema/QaSchema.php at schema version 1.0.0.

TableHolds
{prefix}aiowc_qa_questionsQuestions, with product, author, status and timestamps
{prefix}aiowc_qa_answersAnswers belonging to a question
{prefix}aiowc_qa_votesVotes cast against a question or an answer

REST endpoints​

Namespace aiowc/v1. All responses use the shared envelope.

Public and customer​

MethodPathPurposeRequired argsPermission
GET/qa/product/{id}Questions and answers for a product, filterable by status, paginatedidRate-limited public read
POST/qa/askAsk a question; also accepts author_name and author_emailproduct_id, questionPublic write check
POST/qa/{id}/answerAnswer a questionid, answerSigned in
POST/qa/{id}/voteVote on a question or an answer; target selects whichid, valuePublic write check

Moderation​

Permission: manage. Each takes a type argument selecting question or answer.

MethodPathPurposeRequired args
GET/qa/moderation/queuePending items, filterable by type, paginated—
POST/qa/moderation/{id}/approveApprove an itemid
POST/qa/moderation/{id}/rejectReject an itemid
POST/qa/moderation/{id}/spamMark an item as spamid

WooCommerce and WordPress integration​

HookPriorityEffect
woocommerce_after_single_product_summary60Renders the Q&A block below the product summary
initdefaultHandles the non-JavaScript form submission

Shortcode​

ShortcodePurpose
[aiowc_qa]Renders the Q&A list. Registered only when enable_shortcode is on

No block is registered, and the module hooks no WooCommerce order or email action.

Background jobs​

HookSchedulePurpose
aiowc_qa_notify_unansweredDaily, on the WordPress cron schedulerNotifies the shop about unanswered questions

Entitlement limits​

The qa entitlement gates the module as a whole. There is no cap on questions, answers or votes in the module's code.