Publishing is enforced on the server, in three layers. The React panel only assists.
| Layer | Hook | Covers |
|---|---|---|
| A | wp_insert_post_data (filter, priority 10) | The classic editor, Quick Edit, Bulk Edit, and wp_insert_post() / wp_update_post() calls. Runs before the row is written, so nothing needs undoing. |
| B | woocommerce_before_product_object_save (action, priority 10) | WooCommerce CRUD writes: /wc/v3/products, the product block editor, importers, and $product->save() from other code. The object holds the intended final state here. |
| C | future_to_publish (action, priority 5) | Backstop for scheduled publishing, which bypasses Layer A (wp_publish_post() writes the status directly). |
When a product that is moving into publish or future fails a required rule:
- Layers A and B keep it as it was (
draftorpending), otherwisedraft. Field edits made in the same save are kept; only the publish is refused. - Layer C reverts it to
draftand queues a notice for the post author. - The user sees an admin notice naming the failed rules: on the product editor for that product, and on the products list for every product refused by a Quick or Bulk Edit. Notices live in a 60-second per-user transient,
sit_wcpg_blocked_{user_id}.
Nothing is enforced when:
- the checklist is off, or Prevent publishing when required checks fail is off;
- the product is already
publish(an update to a live product); - the request is an autosave or a revision;
- the enforcement scope excludes the request (below);
- the user may override the guard (below).
Scope
The Enforcement applies to setting (publishing.enforce_scope):
authenticated(default): every request with a signed-in user, including REST and code that saves products for that user.editor: only admin save payloads (classic editor, Quick Edit, Bulk Edit).
Always excluded at Layers A and B: wp_doing_cron(), WP-CLI, and requests with no user. Layer C is the cron case, so the cron exclusion does not apply to it.
The WooCommerce CSV product importer is not excluded. It runs over AJAX as the signed-in user and saves through $product->save(), so under authenticated a row that fails a required rule is imported as a draft (source crud). The editor scope exempts it. Variable and grouped parents are not refused for their missing children, because child_products is a warning by default.
Override
can_override() is true only when Allow users who can manage WooCommerce to publish anyway is on (off by default) and the user has manage_woocommerce. An overridden publish goes through, shows an “override used” notice and is added to the override log (see “Stored data”). No capability is registered and no role is modified.
Products that are already live
Enforcement applies only to transitions into publish / future. A live product that later fails a rule is shown in its checklist, the list column and the catalog screen, but it is never demoted. Otherwise, a settings change could take a whole catalogue offline.
Readiness store
The products list filter and the catalog screen need to query readiness across the whole catalog, so each product’s result is stored in three protected post meta keys:
| Key | Holds |
|---|---|
_sit_wcpg_readiness | pass, warning, fail or skipped |
_sit_wcpg_readiness_sig | the signature the status was computed under |
_sit_wcpg_readiness_data | required_failures (rule ids) and checked_at (a timestamp) |
The keys are written with update_post_meta(), so saving a flag changes neither post_modified nor the checklist cache key. A duplicated product does not copy them.
When it is written. Readiness_Indexer marks a product dirty when it is saved, or when one of its variations changes, and validates each marked product once, at shutdown, so the classic editor’s double save costs one validation. A request from the storefront never validates: it queues the ids for Action Scheduler instead. That also covers a REST request from a user who cannot edit_products, such as the block checkout. A trashed, deleted or auto-draft product carries no flag. Indexing fails open, so an error is logged under WP_DEBUG and the save goes ahead. Nothing is written while the checklist is switched off.
Staleness. The signature is md5( Settings::get_hash() . '|' . Checklist_Service::CACHE_VERSION . '|' . SIT_WCPG_VERSION ). A settings change, a newly registered rule or a plugin release therefore makes every stored flag stale.
The rebuild. Readiness_Rebuild queues Action Scheduler jobs in the group sit-wcpg, 50 products at a time, and records its progress in sit_wcpg_readiness_index. It runs after a settings change, on the first admin request of a new plugin version, and when the products list, catalog or settings screen finds a stale signature. A job whose signature is no longer current exits without working. Nothing recurs. While flags are stale, a filtered products list and the catalog screen show a banner with the progress. Without Action Scheduler nothing is queued, the banner says so, and wp sit-wcpg reindex does the same work in one process.
The column stays live. The readiness column validates each row when the list is shown and never reads the store, so a stale flag cannot mislabel a row. Only the filter and the catalog screen read stored flags.
Documented limitations
- Layer C window. A scheduled product that was valid when scheduled but broken before its time comes is published by cron, then reverted by the backstop in the same request. For the length of that request it is technically live. Layer A refuses to schedule a failing product in the first place, so this needs the product to be broken after it was scheduled.
- Product block editor. The checklist panel exists only in the classic product editor, which from WooCommerce 11.0 is the only product editor. On WooCommerce 9.x and 10.x, where the product block editor was an optional beta, the panel does not appear in it; a warning on the products list and the settings page explains why. Enforcement still applies, because that editor saves through
/wc/v3/products, which Layer B covers. - Bulk Edit relative prices. Bulk Edit’s “increase / decrease by” price modes are not modelled. A product with no price that such an edit would raise from zero is judged on its stored, empty price.
- Unsaved variation values. The live checklist reads variations from storage. A value typed into a variation is not in the checklist until the variation is saved. At publish time it is stored, because the classic editor saves dirty variations first.
- Grouped results on a persistent object cache. The cached checklist of a variable product is flushed whenever one of its variations changes. A grouped product’s is not flushed when a linked product changes, so on a site with a persistent object cache its
child_productsresult in the products list can be stale for up toChecklist_Service::CACHE_TTL(300 seconds). The publish guard is not affected: it never reads the cache. - Bulk Edit of a grouped product with its children. Bulk-publishing a grouped product together with its draft children can refuse the parent when
child_productsis required, because WordPress may save the parent before the children are published. Publishing the parent again succeeds. - Sorting. The products list can be filtered by stored readiness, but not sorted by it.
- Concurrent overrides. The override log is an option that is read and rewritten without a lock, so two overrides at the same instant can lose one entry.
- The client-side prompt is advisory. The editor warns and asks for confirmation before a publish that will be refused, but it never disables the Publish button. The server decides and always reports the outcome.