Commit 13e219d77c4 for woocommerce
commit 13e219d77c42509d37a847491c2f794f5c1b95e1
Author: AnnaMag <AnnaMag@users.noreply.github.com>
Date: Tue Nov 24 16:22:58 2026 +0100
Agent readiness: full product names, Store access with AI shopping off, badge wording, and no feature flag (#71325)
* Agent readiness: show product names in full
Names were stripped of anything that looked like an HTML tag, so a
product named Baker's <Dozen> showed as Baker's. The page and the
support report show names as text, so they now use the saved name with
entities decoded, through one helper.
* Agent readiness: Store access with AI shopping off and nothing to check offers to turn it on
With AI shopping off, a Store access card with no other check showed
only the note under a Not checked yet badge. As in case 5 of the 23 Nov
content review, it now says these checks run once AI shopping is on,
with a Turn on AI shopping button. A card that has checks keeps them
and the note.
* Agent readiness: read product names from the post, which the support report primes
Loading each product for its name cost a product read per named product
in the support report, past what its post cache priming covers.
* Agent readiness: changelog for the Store access card with AI shopping off
* Agent readiness: README names the badges the page shows
* Agent readiness: Couldn't check when a check couldn't run, Not checked yet while it waits for the merchant
Badges follow the agreed rule from the content review: Couldn't check
when a check tried to run and couldn't, as when the host blocks the
store's pages; Not checked yet in coming soon mode, with no products or
none that can be checked, and with nothing to check, such as Store
access while AI shopping is off. Rows that couldn't run, and the extra
details card's unread items, follow the same rule.
* Agent readiness: remove the agent_readiness feature flag
Sales readiness, the AI tools settings tab, the REST routes, the
abilities, the Products list filter, the daily scan and the tracker
snapshot no longer check the flag. The flag never shipped in a release,
so its definition and AgenticCommerceSettings::FEATURE_ID go too.
The tracker snapshot keeps feature_enabled, now always yes, so readers
of the snapshot keep working. Scans still start only when a merchant
runs the first check.
* Agent readiness: README no longer describes the removed feature flag
* Agent readiness: after launch, say the last check ran while coming soon
A store checked in coming soon mode then launched was told hosting blocked the page checks. Use the stored launched row so the cards wait for the next check instead.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Add changelog for coming soon then launched messaging
Co-authored-by: Cursor <cursoragent@cursor.com>
* Agent readiness: document product_name as plain text callers must escape
Co-authored-by: Cursor <cursoragent@cursor.com>
* Agent readiness: register abilities in the canonical list for MCP schemas
Without the feature flag the get and run abilities always load; list them for permission tests and omit empty input properties so MCP clients compile the schema.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Agent readiness: declare nullable ability fields with anyOf
Core ability schema checks require one type per branch. Use anyOf with a null branch instead of a type list, and allow that null branch in the single-types test.
Co-authored-by: Cursor <cursoragent@cursor.com>
* Agent readiness: Not checked yet for a check waiting on launch or a product
A check that a scan in coming soon mode didn't run now says Not checked yet after
launch, on its own row and in the support report, even when other checks in its
question passed. A product page check on a store with no product to check is
recorded as no_product and says it needs a product page, instead of saying it
couldn't run.
* Agent readiness: leave out unavailable ability fields instead of null
Core ability output types are never nullable (Abilities/AGENTS.md). The report and
run-check abilities now drop every null field, such as report before the first
scan or ok on a check that couldn't run, and their schemas declare one type per
field. The single-types test keeps its original assertion that no type is null.
* Agent readiness: changelog uses the menu name, AI shopping health
* Agent readiness: PHPStan types for the no-product flag and ability output
---------
diff --git a/plugins/woocommerce/changelog/add-agent-readiness-remove-feature-flag b/plugins/woocommerce/changelog/add-agent-readiness-remove-feature-flag
new file mode 100644
index 00000000000..c8cb354c21c
--- /dev/null
+++ b/plugins/woocommerce/changelog/add-agent-readiness-remove-feature-flag
@@ -0,0 +1,4 @@
+Significance: minor
+Type: add
+
+Add AI shopping health and AI shopping settings for every store.
diff --git a/plugins/woocommerce/changelog/fix-agent-readiness-checked-while-coming-soon b/plugins/woocommerce/changelog/fix-agent-readiness-checked-while-coming-soon
new file mode 100644
index 00000000000..ec0a27ed62d
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-agent-readiness-checked-while-coming-soon
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+After launching a store checked in coming soon mode, AI shopping health waits for the next check instead of saying hosting blocked it.
diff --git a/plugins/woocommerce/changelog/fix-agent-readiness-no-product-not-checked b/plugins/woocommerce/changelog/fix-agent-readiness-no-product-not-checked
new file mode 100644
index 00000000000..d43f94e3939
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-agent-readiness-no-product-not-checked
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+In AI shopping health, a check that needs a product page says Not checked yet when the store has no product to check.
diff --git a/plugins/woocommerce/changelog/fix-agent-readiness-product-names b/plugins/woocommerce/changelog/fix-agent-readiness-product-names
new file mode 100644
index 00000000000..fbf161e9aac
--- /dev/null
+++ b/plugins/woocommerce/changelog/fix-agent-readiness-product-names
@@ -0,0 +1,4 @@
+Significance: patch
+Type: fix
+
+Show product names in AI shopping health in full, including names with angle brackets.
diff --git a/plugins/woocommerce/changelog/update-agent-readiness-badges b/plugins/woocommerce/changelog/update-agent-readiness-badges
new file mode 100644
index 00000000000..a5a95859bce
--- /dev/null
+++ b/plugins/woocommerce/changelog/update-agent-readiness-badges
@@ -0,0 +1,4 @@
+Significance: patch
+Type: tweak
+
+In AI shopping health, say Couldn’t check when a check couldn’t run, and Not checked yet only while checks wait for the merchant.
diff --git a/plugins/woocommerce/changelog/update-agent-readiness-store-access-ucp-off b/plugins/woocommerce/changelog/update-agent-readiness-store-access-ucp-off
new file mode 100644
index 00000000000..04967a38361
--- /dev/null
+++ b/plugins/woocommerce/changelog/update-agent-readiness-store-access-ucp-off
@@ -0,0 +1,4 @@
+Significance: patch
+Type: tweak
+
+Offer to turn on AI shopping from the Store access card when it has nothing else to check.
diff --git a/plugins/woocommerce/client/admin/client/layout/controller.js b/plugins/woocommerce/client/admin/client/layout/controller.js
index c3af5d736ef..8b3495bf276 100644
--- a/plugins/woocommerce/client/admin/client/layout/controller.js
+++ b/plugins/woocommerce/client/admin/client/layout/controller.js
@@ -216,26 +216,24 @@ export const getPages = ( reports = [] ) => {
},
} );
- if ( isFeatureEnabled( 'agent_readiness' ) ) {
- pages.push( {
- container: SalesReadiness,
- // No spinner while the page's code loads; the page shows none while its view loads either.
- fallback: () => null,
- layout: {
- header: false,
- },
- path: '/sales-readiness',
- breadcrumbs: [
- ...initialBreadcrumbs,
- __( 'Sales readiness', 'woocommerce' ),
- ],
- wpOpenMenu: 'toplevel_page_woocommerce',
- capability: 'manage_woocommerce',
- navArgs: {
- id: 'woocommerce-sales-readiness',
- },
- } );
- }
+ pages.push( {
+ container: SalesReadiness,
+ // No spinner while the page's code loads; the page shows none while its view loads either.
+ fallback: () => null,
+ layout: {
+ header: false,
+ },
+ path: '/sales-readiness',
+ breadcrumbs: [
+ ...initialBreadcrumbs,
+ __( 'Sales readiness', 'woocommerce' ),
+ ],
+ wpOpenMenu: 'toplevel_page_woocommerce',
+ capability: 'manage_woocommerce',
+ navArgs: {
+ id: 'woocommerce-sales-readiness',
+ },
+ } );
pages.push( {
container: CoreProfiler,
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/components/check-row.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/components/check-row.tsx
index 030d659ec7e..7036e6675e1 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/components/check-row.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/components/check-row.tsx
@@ -250,7 +250,9 @@ export const CheckRow = ( {
const states: Record< CheckRowData[ 'state' ], string > = {
open: __( 'Issue:', 'woocommerce' ),
required: __( 'Issue:', 'woocommerce' ),
- unknown: __( 'Not checked yet:', 'woocommerce' ),
+ unknown: row.waiting
+ ? __( 'Not checked yet:', 'woocommerce' )
+ : __( 'Couldn’t check:', 'woocommerce' ),
pass: __( 'Passed:', 'woocommerce' ),
};
return (
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/components/section-card.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/components/section-card.tsx
index 0052f4ea479..653ec58303b 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/components/section-card.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/components/section-card.tsx
@@ -207,9 +207,11 @@ export const SectionCard = ( { section }: { section: Section } ) => {
);
};
-const declaredState = ( found: boolean | null ) => {
+const declaredState = ( found: boolean | null, waiting?: boolean ) => {
if ( found === null ) {
- return __( 'Not checked yet:', 'woocommerce' );
+ return waiting
+ ? __( 'Not checked yet:', 'woocommerce' )
+ : __( 'Couldn’t check:', 'woocommerce' );
}
return found
? __( 'Found:', 'woocommerce' )
@@ -307,7 +309,8 @@ export const DeclaredCard = ( { declared }: { declared: Declared } ) => (
<Text variant="body-sm">
<VisuallyHidden>
{ declaredState(
- item.found
+ item.found,
+ declared.waiting
) }{ ' ' }
</VisuallyHidden>
{ item.name }
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/test/check-row.test.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/test/check-row.test.tsx
index 408c75f5b7d..8479e1b3b1a 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/test/check-row.test.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/test/check-row.test.tsx
@@ -204,6 +204,20 @@ describe( 'CheckRow', () => {
).toHaveAttribute( 'href', '/wp-admin/visibility' );
} );
+ it( 'says Not checked yet when a check waits for the merchant, as in coming soon mode', () => {
+ renderRow(
+ row( {
+ state: 'unknown',
+ title: 'Your store is in coming soon mode',
+ text: 'These checks run once your store is live.',
+ waiting: true,
+ } )
+ );
+
+ expect( screen.getByText( 'Not checked yet:' ) ).toBeInTheDocument();
+ expect( screen.queryByText( 'Couldn’t check:' ) ).toBeNull();
+ } );
+
it( 'says when a check could not run, with what happened', () => {
renderRow(
row( {
@@ -213,7 +227,7 @@ describe( 'CheckRow', () => {
} )
);
- expect( screen.getByText( 'Not checked yet:' ) ).toBeInTheDocument();
+ expect( screen.getByText( 'Couldn’t check:' ) ).toBeInTheDocument();
expect(
screen.getByText( "This couldn't be checked. Try again later." )
).toBeInTheDocument();
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/test/section-card.test.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/test/section-card.test.tsx
index 07459c25b4c..c8294f8d75c 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/test/section-card.test.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/test/section-card.test.tsx
@@ -129,7 +129,7 @@ describe( 'DeclaredCard', () => {
],
},
{
- title: 'Not checked yet',
+ title: 'Couldn’t check',
items: [ { name: 'TDMRep', found: null } ],
},
],
@@ -148,10 +148,37 @@ describe( 'DeclaredCard', () => {
expect( groups[ 0 ] ).toHaveTextContent( 'Files in your root folder' );
expect( groups[ 0 ] ).toHaveTextContent( 'Found: ai.txt usage file' );
expect( groups[ 0 ] ).toHaveTextContent( 'Not found: AGENTS.md' );
- expect( groups[ 1 ] ).toHaveTextContent( 'Not checked yet: TDMRep' );
+ expect( groups[ 1 ] ).toHaveTextContent( 'Couldn’t check: TDMRep' );
// Missing items say so on screen, as in the design; found and not checked ones don't.
expect( groups[ 0 ] ).toHaveTextContent( 'AGENTS.md · not found' );
expect( groups[ 0 ] ).not.toHaveTextContent( 'ai.txt usage file ·' );
expect( groups[ 1 ] ).not.toHaveTextContent( 'not found' );
} );
+
+ it( 'says Not checked yet for unread items while the store is in coming soon mode', async () => {
+ const { container } = render(
+ <DeclaredCard
+ declared={ {
+ title: 'Extra details for AI assistants',
+ badge: { intent: 'none', text: 'Optional' },
+ text: '',
+ waiting: true,
+ groups: [
+ {
+ title: 'Not checked yet',
+ items: [ { name: 'TDMRep', found: null } ],
+ },
+ ],
+ } }
+ />
+ );
+
+ await userEvent.click(
+ screen.getByText( 'Extra details for AI assistants' )
+ );
+
+ expect(
+ container.querySelector( '.wc-sales-readiness-declared__group' )
+ ).toHaveTextContent( 'Not checked yet: TDMRep' );
+ } );
} );
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/types.ts b/plugins/woocommerce/client/admin/client/sales-readiness/types.ts
index f5483efe40e..fb0ee66ed7b 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/types.ts
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/types.ts
@@ -42,6 +42,8 @@ export interface CheckRow {
seen_at: ViewLink | null;
/** A name in the text to link, such as a tool to test with. */
text_link?: TextLink | null;
+ /** A check that couldn't run because it waits for the merchant, as in coming soon mode. */
+ waiting?: boolean;
}
export interface FixFirstItem {
@@ -88,7 +90,9 @@ export interface Declared {
title: string;
badge: ViewBadge;
text: string;
- /** Items under where they live: root folder, standard addresses, page code, extra details, not checked yet. */
+ /** Whether unread items wait for the store to go live (coming soon mode). */
+ waiting?: boolean;
+ /** Items under where they live: root folder, standard addresses, page code, extra details, couldn't check. */
groups: {
title: string;
/** `found` is null for an item the scan couldn't read. */
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/AgentReadiness.php b/plugins/woocommerce/src/Internal/AgentReadiness/AgentReadiness.php
index 13d2d82651f..54bf15e27a1 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/AgentReadiness.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/AgentReadiness.php
@@ -468,7 +468,7 @@ class AgentReadiness {
*
* @param array<string, mixed>|null $report Stored report.
* @param array<int, array{id:string,ok:bool|null,blocks:string,level:string,name:string,label:string,why:string,fix:string,fix_url:string}>|null $live Store conditions already read, or null to read them.
- * @return array<int, array{id:string,ok:bool|null,blocks:string,group?:string,level:string,name:string,label:string,why:string,fix:string,fix_url:string,conflict?:bool,pending?:bool,skipped?:bool,seen_at?:string,source?:string,product?:int}>
+ * @return array<int, array{id:string,ok:bool|null,blocks:string,group?:string,level:string,name:string,label:string,why:string,fix:string,fix_url:string,conflict?:bool,pending?:bool,skipped?:bool,no_product?:bool,seen_at?:string,source?:string,product?:int}>
*/
public function get_store_checks( ?array $report, ?array $live = null ): array {
$checks = $live ?? $this->store_conditions->all();
@@ -481,23 +481,24 @@ class AgentReadiness {
continue;
}
$checks[] = array(
- 'id' => (string) $check['id'],
- 'ok' => isset( $check['ok'] ) ? (bool) $check['ok'] : null,
- 'blocks' => (string) ( $check['blocks'] ?? '' ),
- 'group' => (string) ( $check['group'] ?? '' ),
- 'level' => StoreConditions::LEVEL_RECOMMENDED,
- 'name' => (string) $check['name'],
- 'label' => (string) ( $check['label'] ?? '' ),
- 'why' => (string) ( $check['why'] ?? '' ),
- 'fix' => (string) ( $check['fix'] ?? '' ),
- 'fix_url' => (string) ( $check['fix_url'] ?? '' ),
- 'conflict' => ! empty( $check['conflict'] ),
- 'pending' => ! empty( $check['pending'] ),
- 'skipped' => ! empty( $check['skipped'] ),
- 'seen_at' => (string) ( $check['seen_at'] ?? '' ),
- 'source' => sanitize_text_field( (string) ( $check['source'] ?? '' ) ),
+ 'id' => (string) $check['id'],
+ 'ok' => isset( $check['ok'] ) ? (bool) $check['ok'] : null,
+ 'blocks' => (string) ( $check['blocks'] ?? '' ),
+ 'group' => (string) ( $check['group'] ?? '' ),
+ 'level' => StoreConditions::LEVEL_RECOMMENDED,
+ 'name' => (string) $check['name'],
+ 'label' => (string) ( $check['label'] ?? '' ),
+ 'why' => (string) ( $check['why'] ?? '' ),
+ 'fix' => (string) ( $check['fix'] ?? '' ),
+ 'fix_url' => (string) ( $check['fix_url'] ?? '' ),
+ 'conflict' => ! empty( $check['conflict'] ),
+ 'pending' => ! empty( $check['pending'] ),
+ 'skipped' => ! empty( $check['skipped'] ),
+ 'no_product' => ! empty( $check['no_product'] ),
+ 'seen_at' => (string) ( $check['seen_at'] ?? '' ),
+ 'source' => sanitize_text_field( (string) ( $check['source'] ?? '' ) ),
// The product whose page failed, so the found line can name it.
- 'product' => absint( $check['product'] ?? 0 ),
+ 'product' => absint( $check['product'] ?? 0 ),
);
}
return $checks;
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/AgenticCommerceSettings.php b/plugins/woocommerce/src/Internal/AgentReadiness/AgenticCommerceSettings.php
index 1ebef816b18..03d59ac8222 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/AgenticCommerceSettings.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/AgenticCommerceSettings.php
@@ -3,22 +3,18 @@ declare( strict_types = 1 );
namespace Automattic\WooCommerce\Internal\AgentReadiness;
-use Automattic\WooCommerce\Internal\Features\FeaturesController;
use Automattic\WooCommerce\Internal\Jetpack\JetpackConnection;
use Automattic\WooCommerce\Internal\RegisterHooksInterface;
defined( 'ABSPATH' ) || exit;
/**
- * Adds the WooCommerce > Settings > AI tools tab while the
- * agent_readiness feature is enabled, and names the options it saves.
+ * Adds the WooCommerce > Settings > AI tools tab, and names the options it saves.
*
* @since 11.4.0
*/
class AgenticCommerceSettings implements RegisterHooksInterface {
- public const FEATURE_ID = 'agent_readiness';
-
public const TAB = 'agentic-commerce';
/**
@@ -51,12 +47,6 @@ class AgenticCommerceSettings implements RegisterHooksInterface {
*/
public const WARRANTY_PAGE_OPTION = 'woocommerce_warranty_page_id';
- /**
- * Features controller.
- *
- * @var FeaturesController
- */
- private FeaturesController $features_controller;
/**
* Store conditions.
@@ -84,16 +74,14 @@ class AgenticCommerceSettings implements RegisterHooksInterface {
*
* @internal
*
- * @param FeaturesController $features_controller Features controller.
* @param StoreConditions $store_conditions Store conditions.
* @param AgentReadiness $agent_readiness Readiness service.
* @param ReadinessCheckPage $readiness_page Sales readiness.
*/
- final public function init( FeaturesController $features_controller, StoreConditions $store_conditions, AgentReadiness $agent_readiness, ReadinessCheckPage $readiness_page ): void {
- $this->features_controller = $features_controller;
- $this->store_conditions = $store_conditions;
- $this->agent_readiness = $agent_readiness;
- $this->readiness_page = $readiness_page;
+ final public function init( StoreConditions $store_conditions, AgentReadiness $agent_readiness, ReadinessCheckPage $readiness_page ): void {
+ $this->store_conditions = $store_conditions;
+ $this->agent_readiness = $agent_readiness;
+ $this->readiness_page = $readiness_page;
}
/**
@@ -113,12 +101,12 @@ class AgenticCommerceSettings implements RegisterHooksInterface {
}
/**
- * Add the settings page when the feature is enabled.
+ * Add the settings page in the admin.
*
* @internal
*/
public function handle_init(): void {
- if ( ! is_admin() || ! $this->features_controller->feature_is_enabled( self::FEATURE_ID ) ) {
+ if ( ! is_admin() ) {
return;
}
add_filter( 'woocommerce_get_settings_pages', array( $this, 'handle_woocommerce_get_settings_pages' ) );
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/AgenticCommerceSettingsPage.php b/plugins/woocommerce/src/Internal/AgentReadiness/AgenticCommerceSettingsPage.php
index c308e786e17..091ba481998 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/AgenticCommerceSettingsPage.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/AgenticCommerceSettingsPage.php
@@ -12,8 +12,8 @@ defined( 'ABSPATH' ) || exit;
* card, the AI shopping card and the Sales readiness card; Manage opens AI shopping, a React view with the UCP switch, Product visibility, the
* Setup checklist, the store policy fields and the connection URL. settings-embed mounts both, from data
* this class builds. The UCP switch saves on its own through wc/v3/agent-readiness/ucp; the store policy
- * fields save with Save, which posts this settings form. Only created by AgenticCommerceSettings while the
- * agent_readiness feature is enabled, after WC_Settings_Page has loaded.
+ * fields save with Save, which posts this settings form. Only created by AgenticCommerceSettings,
+ * after WC_Settings_Page has loaded.
*
* @since 11.4.0
*/
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/ProductsList.php b/plugins/woocommerce/src/Internal/AgentReadiness/ProductsList.php
index 1a94801b5fe..3ade1e476fd 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/ProductsList.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/ProductsList.php
@@ -3,8 +3,6 @@ declare( strict_types = 1 );
namespace Automattic\WooCommerce\Internal\AgentReadiness;
-use Automattic\WooCommerce\Internal\Features\FeaturesController;
-
defined( 'ABSPATH' ) || exit;
/**
@@ -27,12 +25,6 @@ class ProductsList {
*/
private const READINESS_META = array( '_wc_gla_brand', '_wc_gla_mpn' );
- /**
- * Features controller.
- *
- * @var FeaturesController
- */
- private FeaturesController $features_controller;
/**
* Readiness service.
@@ -67,12 +59,10 @@ class ProductsList {
*
* @internal
*
- * @param FeaturesController $features_controller Features controller.
- * @param AgentReadiness $agent_readiness Readiness service.
+ * @param AgentReadiness $agent_readiness Readiness service.
*/
- final public function init( FeaturesController $features_controller, AgentReadiness $agent_readiness ): void {
- $this->features_controller = $features_controller;
- $this->agent_readiness = $agent_readiness;
+ final public function init( AgentReadiness $agent_readiness ): void {
+ $this->agent_readiness = $agent_readiness;
}
/**
@@ -161,7 +151,7 @@ class ProductsList {
* @param \WC_Product $product Product.
*/
private function retest( \WC_Product $product ): void {
- if ( ! $this->agent_readiness->has_report() || ! $this->enabled() ) {
+ if ( ! $this->agent_readiness->has_report() ) {
return;
}
$product_id = $product instanceof \WC_Product_Variation ? $product->get_parent_id() : $product->get_id();
@@ -295,7 +285,7 @@ class ProductsList {
public function apply_filter( $query ): void {
global $pagenow;
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- A list filter that changes nothing.
- if ( ! $query instanceof \WP_Query || ! is_admin() || 'edit.php' !== $pagenow || ! $query->is_main_query() || 'product' !== $query->get( 'post_type' ) || ! $this->enabled() || empty( $_GET[ self::FILTER_PARAM ] ) ) {
+ if ( ! $query instanceof \WP_Query || ! is_admin() || 'edit.php' !== $pagenow || ! $query->is_main_query() || 'product' !== $query->get( 'post_type' ) || empty( $_GET[ self::FILTER_PARAM ] ) ) {
return;
}
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- A list filter that changes nothing.
@@ -334,7 +324,7 @@ class ProductsList {
public function filter_notice(): void {
$screen = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
// phpcs:ignore WordPress.Security.NonceVerification.Recommended -- Only reads whether the list filter is set.
- if ( ! $screen || 'edit-product' !== $screen->id || ! $this->enabled() || empty( $_GET[ self::FILTER_PARAM ] ) ) {
+ if ( ! $screen || 'edit-product' !== $screen->id || empty( $_GET[ self::FILTER_PARAM ] ) ) {
return;
}
printf(
@@ -344,11 +334,4 @@ class ProductsList {
esc_html__( 'Show all products', 'woocommerce' )
);
}
-
- /**
- * Whether the feature is on.
- */
- private function enabled(): bool {
- return $this->features_controller->feature_is_enabled( AgenticCommerceSettings::FEATURE_ID );
- }
}
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/README.md b/plugins/woocommerce/src/Internal/AgentReadiness/README.md
index 91b9585f6ce..1ef629882e2 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/README.md
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/README.md
@@ -1,6 +1,6 @@
# Agent readiness
-Checks published simple and variable products against the product data specs of AI shopping channels and reports what keeps them from being listed or found. Behind the experimental `agent_readiness` feature flag (disabled by default, not shown on the Features screen).
+Checks published simple and variable products against the product data specs of AI shopping channels and reports what keeps them from being listed or found.
## What the checks read
@@ -184,13 +184,13 @@ Per check, `channels` maps a channel id to the feed field and the effect, the sa
## Background scan and REST
-"Check your store" on WooCommerce > Sales readiness, or `POST wc/v3/agent-readiness/scan`, queues the scan in Action Scheduler (`ScheduledScan`). The report is stored in the `woocommerce_agent_readiness_report` option (not autoloaded). Each run schedules the next one a day later, before scanning, so a failed scan doesn't stop the daily refresh; a run that finds the feature disabled does. If a queued scan still hasn't started 10 minutes after it was due and no other scheduled action has finished, failed or started in that time (Action Scheduler isn't running), the Sales readiness page says so and the scan stays queued. The scan never runs in a page or REST request.
+"Check your store" on WooCommerce > Sales readiness, or `POST wc/v3/agent-readiness/scan`, queues the scan in Action Scheduler (`ScheduledScan`). The report is stored in the `woocommerce_agent_readiness_report` option (not autoloaded). Each run schedules the next one a day later, before scanning, so a failed scan doesn't stop the daily refresh. Cancelling the scheduled actions under Tools > Scheduled Actions stops the chain until the next manual check. If a queued scan still hasn't started 10 minutes after it was due and no other scheduled action has finished, failed or started in that time (Action Scheduler isn't running), the Sales readiness page says so and the scan stays queued. The scan never runs in a page or REST request.
-A scan runs as a chain of actions (`NEXT_HOOK`, with the scan's id), so no action tests more than one batch of products. The first lists the products to test, newest change first, and stores that list with the totals in the `woocommerce_agent_readiness_scan` option (not autoloaded). Starting still reads the store's 90-day sales once (for the total, whether ranking applies, and the best seller for page checks); each later batch reads only its own products' sales, so the whole store's sales map is never kept between actions. Each action tests the next batch of 200, saves the totals and queues the next; the last builds the report, with the store output checks, and stores it. Before testing, an action queues a retry RETRY_AFTER (10 minutes) later, which it removes when it finishes, so a batch that ends early, as on a timeout, is tried again from the last finished batch. After MAX_ATTEMPTS (3) tries of the same batch, the scan stops and the last report stays. Giving up, cancelling, or replacing a scan removes failure rows it wrote for products the last report never covered, so the Products list stays aligned with that report. A new request (or the daily run) replaces a scan in progress and starts over; the replaced scan's actions change nothing. With the feature off, the next action stops the scan. `refresh_report()` runs the same steps in one request.
+A scan runs as a chain of actions (`NEXT_HOOK`, with the scan's id), so no action tests more than one batch of products. The first lists the products to test, newest change first, and stores that list with the totals in the `woocommerce_agent_readiness_scan` option (not autoloaded). Starting still reads the store's 90-day sales once (for the total, whether ranking applies, and the best seller for page checks); each later batch reads only its own products' sales, so the whole store's sales map is never kept between actions. Each action tests the next batch of 200, saves the totals and queues the next; the last builds the report, with the store output checks, and stores it. Before testing, an action queues a retry RETRY_AFTER (10 minutes) later, which it removes when it finishes, so a batch that ends early, as on a timeout, is tried again from the last finished batch. After MAX_ATTEMPTS (3) tries of the same batch, the scan stops and the last report stays. Giving up, cancelling, or replacing a scan removes failure rows it wrote for products the last report never covered, so the Products list stays aligned with that report. A new request (or the daily run) replaces a scan in progress and starts over; the replaced scan's actions change nothing. `refresh_report()` runs the same steps in one request.
On a store with 11,000 products, a scan (stopping at 5,000) took about 4 seconds and 144 MB. A product saved since the scan is already reflected in the counts, as described under Failures per product.
-`GET wc/v3/agent-readiness` returns `{ "report": <report or null>, "scan_pending": <bool>, "scan_stalled": <bool> }` from `AgentReadiness::get_served_report()`, so `store_checks` are read now; `scan_stalled` is true while a queued scan waits on a stalled Action Scheduler. `GET wc/v3/agent-readiness/view` returns what the Sales readiness page and the AI tools Overview show (`ReadinessCheckPage::view()`): text, badges and links only, so the React views render it without knowing the checks. `GET wc/v3/agent-readiness/support-report` returns `{ "filename", "text" }`: the text file "Download your results" saves from the Need help? line (`SupportReport`), with the site, versions, every setup step and store check with its status, the AI shopping state, and product check counts with their example products. Like the System Status Report, its labels are in English and it marks checks ✔ or ❌. It reads the stored report and runs no check, and holds no customer or order data and no keys. All these routes need `manage_woocommerce` and exist only while the feature is enabled.
+`GET wc/v3/agent-readiness` returns `{ "report": <report or null>, "scan_pending": <bool>, "scan_stalled": <bool> }` from `AgentReadiness::get_served_report()`, so `store_checks` are read now; `scan_stalled` is true while a queued scan waits on a stalled Action Scheduler. `GET wc/v3/agent-readiness/view` returns what the Sales readiness page and the AI tools Overview show (`ReadinessCheckPage::view()`): text, badges and links only, so the React views render it without knowing the checks. `GET wc/v3/agent-readiness/support-report` returns `{ "filename", "text" }`: the text file "Download your results" saves from the Need help? line (`SupportReport`), with the site, versions, every setup step and store check with its status, the AI shopping state, and product check counts with their example products. Like the System Status Report, its labels are in English and it marks checks ✔ or ❌. It reads the stored report and runs no check, and holds no customer or order data and no keys. All these routes need `manage_woocommerce`.
The same shape is meant for every consumer: WooCommerce > Sales readiness and AI shopping, an outside scan of a store, and extensions that rank the findings by sales or offer fixes. Check and channel ids are stable keys.
@@ -198,14 +198,14 @@ The scan walks published simple and variable products not set to Hidden in batch
## Abilities
-While the feature is enabled, `AbilitiesLoader` registers these abilities in the WordPress Abilities API with the `Ability` class, which converts their input to the schema types. Each definition class in this directory owns its arguments. They show in REST and to MCP clients, for users with `manage_woocommerce`:
+`AbilitiesLoader` registers these abilities in the WordPress Abilities API with the `Ability` class, which converts their input to the schema types. Each definition class in this directory owns its arguments. They show in REST and to MCP clients, for users with `manage_woocommerce`:
-- `woocommerce/get-agent-readiness` and `GET wc/v3/agent-readiness` both return `{ report, scan_pending, scan_stalled }` from `AgentReadiness::get_served_report()`: settings changed since the scan show their current state, and store output checks come from the stored report.
+- `woocommerce/get-agent-readiness` and `GET wc/v3/agent-readiness` both return `{ report, scan_pending, scan_stalled }` from `AgentReadiness::get_served_report()`: settings changed since the scan show their current state, and store output checks come from the stored report. The abilities leave out every field that would be null, as Core abilities do: `report` before the first scan, `ok` on a check that couldn't run, `sales_share` and `sales` without sales to compare, and `report_generated_at`.
- `woocommerce/run-agent-readiness-check` with `product_id` checks that product now (`check_product()`) and returns its failing checks with label and fix, and its status per channel. Without one it queues the background scan, like `POST wc/v3/agent-readiness/scan`, and returns `scan_pending`, `scan_stalled` and `report_generated_at`, so the agent knows when to read the report again, or that it won't change until scheduled actions run.
## AI tools and Sales readiness
-WooCommerce > Settings > AI tools (`AgenticCommerceSettings`, `AgenticCommerceSettingsPage`; the tab id stays `agentic-commerce`) and WooCommerce > Sales readiness (`ReadinessCheckPage`, a WooCommerce Admin page at `admin.php?page=wc-admin&path=/sales-readiness`, between Reports and Settings in the menu) show while the feature is enabled. They follow the WOOPRD-3796 and WOOPRD-3947 designs. Both are React views on `@wordpress/ui` in `client/admin/client/sales-readiness/`, fed by `GET wc/v3/agent-readiness/view`; every string, badge and ranking is built in `ReadinessCheckPage::view()`, where the tests are. AI tools opens on the Overview, a React root mounted by the `settings-embed` script, with two cards. The AI shopping card has the Status badge, whether AI assistants can shop the store and how many setup steps are left, and a button that opens AI shopping (`§ion=shopping`): Continue setup while a required step is left, otherwise View settings. Before the UCP setting is first saved, the card says what AI shopping does and offers Set up AI shopping instead; once UCP is turned off, it says AI shopping is off. The Sales readiness card has Fix first (no card when nothing fails; Check your store before the first scan) and View all checks, which opens the page. AI shopping (`§ion=shopping`) is a React view too (`client/admin/client/sales-readiness/ai-shopping.tsx`, mounted by `settings-embed`): an `@wordpress/admin-ui` Page with a breadcrumb back to AI tools and Save in its header, then `@wordpress/dataviews` DataForm cards. `AgenticCommerceSettingsPage` builds everything it shows (steps with their button labels and links, counts, the policy pages, the connection URL, coming soon) and prints it as JSON on the root, so the page draws without a request. Save posts the WooCommerce settings form around the page: the policy fields are hidden inputs named after their options, so they save and validate through the settings fields as before. The page warns before leaving with unsaved fields. The AI tools tab and Sales readiness have no admin footer (`AgenticCommerceSettings::handle_admin_footer()`). The wording of setup steps that AI shopping and Sales readiness share is in the `ReadinessMarkup` trait.
+WooCommerce > Settings > AI tools (`AgenticCommerceSettings`, `AgenticCommerceSettingsPage`; the tab id stays `agentic-commerce`) and WooCommerce > Sales readiness (`ReadinessCheckPage`, a WooCommerce Admin page at `admin.php?page=wc-admin&path=/sales-readiness`, between Reports and Settings in the menu) show in the admin. They follow the WOOPRD-3796 and WOOPRD-3947 designs. Both are React views on `@wordpress/ui` in `client/admin/client/sales-readiness/`, fed by `GET wc/v3/agent-readiness/view`; every string, badge and ranking is built in `ReadinessCheckPage::view()`, where the tests are. AI tools opens on the Overview, a React root mounted by the `settings-embed` script, with two cards. The AI shopping card has the Status badge, whether AI assistants can shop the store and how many setup steps are left, and a button that opens AI shopping (`§ion=shopping`): Continue setup while a required step is left, otherwise View settings. Before the UCP setting is first saved, the card says what AI shopping does and offers Set up AI shopping instead; once UCP is turned off, it says AI shopping is off. The Sales readiness card has Fix first (no card when nothing fails; Check your store before the first scan) and View all checks, which opens the page. AI shopping (`§ion=shopping`) is a React view too (`client/admin/client/sales-readiness/ai-shopping.tsx`, mounted by `settings-embed`): an `@wordpress/admin-ui` Page with a breadcrumb back to AI tools and Save in its header, then `@wordpress/dataviews` DataForm cards. `AgenticCommerceSettingsPage` builds everything it shows (steps with their button labels and links, counts, the policy pages, the connection URL, coming soon) and prints it as JSON on the root, so the page draws without a request. Save posts the WooCommerce settings form around the page: the policy fields are hidden inputs named after their options, so they save and validate through the settings fields as before. The page warns before leaving with unsaved fields. The AI tools tab and Sales readiness have no admin footer (`AgenticCommerceSettings::handle_admin_footer()`). The wording of setup steps that AI shopping and Sales readiness share is in the `ReadinessMarkup` trait.
AI shopping has one card per part:
@@ -215,11 +215,11 @@ AI shopping has one card per part:
- Store policy pages. Refund and returns, privacy and terms are the existing options, so they stay in sync with Advanced > Page setup and Settings > Privacy; shipping policy, FAQ and warranty are new. They are for the policy links a UCP checkout can carry (`links`); the UCP endpoints don't send them yet. The dropdowns list published pages other than the cart, checkout, shop and My account pages, and saving leaves a stored page in place even when it's a draft or one of those store pages, which then fails its check. A link from the checklist opens the page on its field, focused.
- The connection URL AI assistants start from (`/.well-known/ucp`), read only, with Copy and a link to test it in UCP Playground.
-Sales readiness opens with when the last check ran and Check again ("Check your store" before the first), then Fix first, then a card per question. It shows the setup steps from `StoreConditions` (UCP aside, as the switch) under the question each answers, a failing required one marked Required, and the store output checks from the stored report, since they only run in the scan. Each check names the question it answers in `group` (`access`, `find`, `understand` or `buy`), and each question's card has a badge: how many issues, All passed, or No issues when a check couldn't run. A failing setup step shows in both places: in the Setup checklist and Fix first, and as a row in its question's card, which counts it in its issues. Failing and unchecked rows come first, then passed ones; each card shows the first two and folds the rest behind "Show N more checks", with "Hide" below the opened list. Checks waiting on a later update (`pending`) aren't shown. Output checks are never required, so they don't affect the switch or Status. A failing row is named by its failing title (`label`), then what it affects ("Affects: how AI assistants summarize your store", by check, or from `blocks`), why it matters, what to do and a link. The product checks are their own question, before "Buying through AI assistants". The last card, "What does your store share with AI assistants?", has no badge: it says how many declared items were found ("Found 4 of 33"), with every item behind a fold.
+Sales readiness opens with when the last check ran and Check again ("Check your store" before the first), then Fix first, then a card per question. It shows the setup steps from `StoreConditions` (UCP aside, as the switch) under the question each answers, a failing required one marked Required, and the store output checks from the stored report, since they only run in the scan. Each check names the question it answers in `group` (`access`, `find`, `understand` or `buy`), and each question's card has a badge: how many issues, All passed, Couldn't check when nothing failed but a check tried to run and couldn't, or Not checked yet while the checks wait for the merchant: in coming soon mode, after a check that ran while coming soon once the store is live, with no products or none that can be checked, or with nothing to check, such as Store access while AI shopping is off. A failing check has a Required badge when it is required, and no badge otherwise. A failing setup step shows in both places: in the Setup checklist and Fix first, and as a row in its question's card, which counts it in its issues. Failing and unchecked rows come first, then passed ones; each card shows the first two and folds the rest behind "Show N more checks", with "Hide" below the opened list. Checks waiting on a later update (`pending`) aren't shown. Output checks are never required, so they don't affect the switch or Status. A failing row is named by its failing title (`label`), then what it affects ("Affects: how AI assistants summarize your store", by check, or from `blocks`), why it matters, what to do and a link. The product checks are their own question, before "Buying through AI assistants". The last card, "What does your store share with AI assistants?", has no badge: it says how many declared items were found ("Found 4 of 33"), with every item behind a fold.
The product checks, under "Listings in AI shopping apps", show how many products each channel can list ("2 of 15 can be listed"), then each failing product check, titled with what to do and its count ("Add a brand to 13 products"), why it matters, and "View N products", which opens the Products list filtered to them. With up to three failing products the title names them ("Add a brand to Blue hoodie and Red cap") when their failures are stored; one product without them is "a product", and more than three are counted. The copy is in `ReadinessCopy`. Product image alt text isn't listed there, since the `images_have_alt` store check covers it.
-Fix first, a card of its own, lists the required setup steps that fail, then the top three other issues. Required setup steps include the ones shown as Required (`StoreConditions::SHOWN_REQUIRED`, or `store_checks` in the rules file): `search_visible`, `payment_method`, `order_emails`, `privacy_page`, `terms_page` and `refund_returns_page`. Guest checkout is optional. Of the scanned checks, a failing `ucp_profile` or `ucp_checkout` is Required with UCP on, and so is one that keeps AI assistants off the store's pages, except `pages_public`: a store whose pages all need a login, such as a members-only store, chose that and can still be ready for AI assistants that sign in. It is Recommended: it shows in Store access without a badge and in Fix first under Needed to list products, and doesn't count toward the required steps or keep AI shopping from being turned on. A failing `ucp_endpoints_live` has no badge, like any failing check that isn't Required, and stays out of Fix first, since it can fail now and then with nothing changed on the store. A question card's badge counts its issues, says All passed, or says Not checked yet, before the first check or when nothing failed but a check couldn't run (the row says why). Issues are ranked by what they stop, then by sales: store checks that block `listing` (such as structured data) and product checks that keep products off a channel (`not_listable`), then product checks that only make products harder to find. Within each, the larger share of sales on the affected products comes first, then the larger product count, then page order. Without sales to compare, a product check's count is multiplied by the AI apps it affects, so 3 products kept out of 3 apps come before 5 products kept out of 1. Store checks with no sales link, such as a missing meta description, stay out of Fix first. `ProductSales` reads each product's net sales over the last 90 days from the Analytics lookup tables (`wc_order_product_lookup` joined with `wc_order_stats`), with the order statuses Analytics excludes left out and variations counted toward their parent and on their own. The scan adds up the sales of each check's failing products. A check a variable product fails through some of its variations (a missing price or GTIN, a missing variation image, or an option set to "any") adds only those variations' sales. An invalid GTIN, a GTIN shared with another product, and an image under 500 pixels still count the whole product's sales, which only changes the rank. The report stores each check's `sales_share` (0 to 1) and `sales` (`days`, `orders`, `imported`). While Analytics is off, `sales` is null. With fewer than `ProductSales::MIN_ORDERS` (20) orders in the period, too few to rank by, shares are null. They are null too while a store with at least 20 orders has under 90% of them in Analytics (`imported` false), as when past orders were never imported. Orders in several currencies are summed without conversion, as Analytics does. In both cases Fix first ranks by product count and AI apps, and says why. It says to start with the fixes that affect the most sales, over the period the figures cover, only when an issue on the card sold something; otherwise it says it ranks by product count. A share is rounded to 4 places and any sales keep at least 0.0001, so small sales never read as "No sales". A share is not shown once a check's count changes after the scan, since it was measured on the products failing then, but Fix first still ranks the check by it (`ranked_share`), so fixing one product doesn't move the issue down. Under headings for what each group stops (Required for AI shopping, Needed to list products, Helps shoppers find products), a product issue is badged by its share of sales ("38% of sales"); its line starts with the share, the first saying over which period ("38% of your sales in the last 90 days."); products that sold nothing in the period say "No sales" instead of 0%.
+Fix first, a card of its own, lists the required setup steps that fail, then the top three other issues. Required setup steps include the ones shown as Required (`StoreConditions::SHOWN_REQUIRED`, or `store_checks` in the rules file): `search_visible`, `payment_method`, `order_emails`, `privacy_page`, `terms_page` and `refund_returns_page`. Guest checkout is optional. Of the scanned checks, a failing `ucp_profile` or `ucp_checkout` is Required with UCP on, and so is one that keeps AI assistants off the store's pages, except `pages_public`: a store whose pages all need a login, such as a members-only store, chose that and can still be ready for AI assistants that sign in. It is Recommended: it shows in Store access without a badge and in Fix first under Needed to list products, and doesn't count toward the required steps or keep AI shopping from being turned on. A failing `ucp_endpoints_live` has no badge, like any failing check that isn't Required, and stays out of Fix first, since it can fail now and then with nothing changed on the store. While AI shopping is off, Store access notes that some checks only run when it is on; when the card has no other check to show, it says what turning AI shopping on checks instead, with a Turn on AI shopping button. A question card's badge counts its issues, says All passed, Couldn't check when nothing failed but a check tried to run and couldn't, or Not checked yet while the checks wait for the merchant (the row says why). Issues are ranked by what they stop, then by sales: store checks that block `listing` (such as structured data) and product checks that keep products off a channel (`not_listable`), then product checks that only make products harder to find. Within each, the larger share of sales on the affected products comes first, then the larger product count, then page order. Without sales to compare, a product check's count is multiplied by the AI apps it affects, so 3 products kept out of 3 apps come before 5 products kept out of 1. Store checks with no sales link, such as a missing meta description, stay out of Fix first. `ProductSales` reads each product's net sales over the last 90 days from the Analytics lookup tables (`wc_order_product_lookup` joined with `wc_order_stats`), with the order statuses Analytics excludes left out and variations counted toward their parent and on their own. The scan adds up the sales of each check's failing products. A check a variable product fails through some of its variations (a missing price or GTIN, a missing variation image, or an option set to "any") adds only those variations' sales. An invalid GTIN, a GTIN shared with another product, and an image under 500 pixels still count the whole product's sales, which only changes the rank. The report stores each check's `sales_share` (0 to 1) and `sales` (`days`, `orders`, `imported`). While Analytics is off, `sales` is null. With fewer than `ProductSales::MIN_ORDERS` (20) orders in the period, too few to rank by, shares are null. They are null too while a store with at least 20 orders has under 90% of them in Analytics (`imported` false), as when past orders were never imported. Orders in several currencies are summed without conversion, as Analytics does. In both cases Fix first ranks by product count and AI apps, and says why. It says to start with the fixes that affect the most sales, over the period the figures cover, only when an issue on the card sold something; otherwise it says it ranks by product count. A share is rounded to 4 places and any sales keep at least 0.0001, so small sales never read as "No sales". A share is not shown once a check's count changes after the scan, since it was measured on the products failing then, but Fix first still ranks the check by it (`ranked_share`), so fixing one product doesn't move the issue down. Under headings for what each group stops (Required for AI shopping, Needed to list products, Helps shoppers find products), a product issue is badged by its share of sales ("38% of sales"); its line starts with the share, the first saying over which period ("38% of your sales in the last 90 days."); products that sold nothing in the period say "No sales" instead of 0%.
Tracks event: `agentic_commerce_ucp_toggled` (`enabled`), sent only when the store allows tracking.
@@ -239,9 +239,9 @@ The React views send Tracks events through `@woocommerce/tracks` (`client/admin/
## Usage tracking
-With the flag on, the weekly WC Tracker snapshot (sent only by stores that allow usage tracking) has an `agent_readiness` block, from `Telemetry`:
+The weekly WC Tracker snapshot (sent only by stores that allow usage tracking) has an `agent_readiness` block, from `Telemetry`:
-- `feature_enabled`: `yes` or `no`. With the flag off, the other fields stay empty.
+- `feature_enabled`: always `yes`. Kept from when the feature had a flag, so readers of the snapshot keep working.
- `last_scan`: the day the stored report was built (`Y-m-d`), or empty before the first scan.
- `truncated`: `yes` when the last scan stopped at the product limit, otherwise `no` (including before the first scan). On a truncated scan, product check statuses cover only the products that were checked.
- `store_checks`: each store check id with `pass`, `problem` or `unknown` (couldn't check, or still waiting for a result). Setup steps are read when the snapshot is built, so they are there before the first scan too; output checks come from the stored report.
@@ -262,8 +262,4 @@ Core's UCP catalog mapper (`src/Internal/ProductFeed/Mapping/UcpProductMapper.ph
## Trying it
-```sh
-wp option update woocommerce_feature_agent_readiness_enabled yes
-```
-
-Then open WooCommerce > Sales readiness and select "Check your store". AI shopping is under WooCommerce > Settings > AI tools.
+Open WooCommerce > Sales readiness and select "Check your store". AI shopping is under WooCommerce > Settings > AI tools.
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessAbility.php b/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessAbility.php
index 4bda9ccf641..7392d70add8 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessAbility.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessAbility.php
@@ -3,28 +3,15 @@ declare( strict_types = 1 );
namespace Automattic\WooCommerce\Internal\AgentReadiness;
-use Automattic\WooCommerce\Internal\Features\FeaturesController;
-
defined( 'ABSPATH' ) || exit;
/**
- * What the agent readiness abilities share: the feature gate, the permission, and the channel schema.
+ * What the agent readiness abilities share: the permission and the channel schema.
*
* @since 11.4.0
*/
trait ReadinessAbility {
- /**
- * Ability name while the feature is on, or an empty string so AbilitiesLoader skips it.
- *
- * @param string $name Ability name.
- * @return string
- */
- protected static function name_when_enabled( string $name ): string {
- $features = wc_get_container()->get( FeaturesController::class );
- return $features->feature_is_enabled( AgenticCommerceSettings::FEATURE_ID ) ? $name : '';
- }
-
/**
* Whether the current user may use the ability.
*/
@@ -53,4 +40,22 @@ trait ReadinessAbility {
),
);
}
+
+ /**
+ * The output with every null field left out, at any depth, since Core ability output types are never nullable.
+ * Items of a list stay where they are.
+ *
+ * @param array<mixed> $output Ability output.
+ * @return array<mixed>
+ */
+ protected static function without_nulls( array $output ): array {
+ foreach ( $output as $key => $value ) {
+ if ( null === $value && is_string( $key ) ) {
+ unset( $output[ $key ] );
+ } elseif ( is_array( $value ) ) {
+ $output[ $key ] = self::without_nulls( $value );
+ }
+ }
+ return $output;
+ }
}
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessCheckPage.php b/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessCheckPage.php
index 5d3ce5eb392..33b9510f2df 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessCheckPage.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessCheckPage.php
@@ -11,7 +11,7 @@ use Automattic\WooCommerce\StoreApi\Utilities\Ucp\Utils as UcpUtils;
defined( 'ABSPATH' ) || exit;
/**
- * Sales readiness, while the agent_readiness feature is enabled: when the store was last checked, Fix first,
+ * Sales readiness: when the store was last checked, Fix first,
* then a card per merchant question with the checks from the last scan. It is a WooCommerce Admin page
* under the WooCommerce menu, before Settings; the React page reads everything it shows from
* wc/v3/agent-readiness/view, which this class builds. The same builder gives the AI tools tab its
@@ -170,12 +170,12 @@ class ReadinessCheckPage implements RegisterHooksInterface {
}
/**
- * Add the page while the feature is enabled.
+ * Add the page in the admin.
*
* @internal
*/
public function handle_init(): void {
- if ( ! is_admin() || ! $this->features_controller->feature_is_enabled( AgenticCommerceSettings::FEATURE_ID ) ) {
+ if ( ! is_admin() ) {
return;
}
// After Reports (20) and before Settings (50), as WooCommerce adds them.
@@ -338,7 +338,7 @@ class ReadinessCheckPage implements RegisterHooksInterface {
'fix_first' => null === $report ? null : $this->fix_first( $visible, $report ),
// Setup steps live in the Setup checklist and, while one blocks sales, in Fix first; the cards hold what the scan read.
'sections' => null === $report ? array() : $this->sections( array_values( array_filter( $visible, static fn( array $check ): bool => ! self::is_setup_step( $check ) ) ), $launched, $report ),
- 'declared' => null === $report ? null : self::declared( is_array( $report['declared'] ?? null ) ? $report['declared'] : array() ),
+ 'declared' => null === $report ? null : self::declared( is_array( $report['declared'] ?? null ) ? $report['declared'] : array(), $launched, self::checked_while_live( $report ) ),
'overview' => array(
'shopping' => $this->shopping_card( $checks ),
// After the description, when the last check stopped at the product limit.
@@ -423,13 +423,21 @@ class ReadinessCheckPage implements RegisterHooksInterface {
}
/**
- * The name of the product a page check failed on, '' when there is none or it no longer exists.
+ * A product's saved name as entity-decoded plain text, '' when there is none or it no longer exists.
+ * Read from the post, which callers can prime, rather than loading the product. Not sanitized HTML:
+ * a name such as "Baker's <Dozen>" stays whole. Callers must escape for their output context
+ * (React text nodes need none; HTML or attributes need escaping).
+ *
+ * @since 11.4.0
*
* @param int $product_id Product ID from the report.
*/
- private static function product_name( int $product_id ): string {
- $product = $product_id > 0 ? wc_get_product( $product_id ) : null;
- return $product instanceof \WC_Product ? wp_strip_all_tags( html_entity_decode( $product->get_name(), ENT_QUOTES | ENT_HTML5, 'UTF-8' ) ) : '';
+ public static function product_name( int $product_id ): string {
+ $post = $product_id > 0 ? get_post( $product_id ) : null;
+ if ( ! $post instanceof \WP_Post || ! in_array( $post->post_type, array( 'product', 'product_variation' ), true ) ) {
+ return '';
+ }
+ return html_entity_decode( $post->post_title, ENT_QUOTES | ENT_HTML5, 'UTF-8' );
}
/**
@@ -684,7 +692,7 @@ class ReadinessCheckPage implements RegisterHooksInterface {
return array(
'id' => $id,
'title' => $title,
- 'badge' => self::badge_data( self::cant_check_badge() ),
+ 'badge' => self::badge_data( self::waiting_badge() ),
'note' => null,
'channels' => array(),
'rows' => array(),
@@ -721,8 +729,8 @@ class ReadinessCheckPage implements RegisterHooksInterface {
if ( null === $launched || false !== $launched['ok'] || null === $report ) {
return null;
}
- $was_live = array_column( is_array( $report['store_checks'] ?? null ) ? $report['store_checks'] : array(), 'ok', 'id' )['launched'] ?? null;
- if ( true !== $was_live ) {
+ // Only when the stored results are from a live check; a coming soon check says why on the cards.
+ if ( true !== self::checked_while_live( $report ) ) {
return null;
}
return array(
@@ -735,37 +743,90 @@ class ReadinessCheckPage implements RegisterHooksInterface {
);
}
+ /**
+ * Whether the store was live when the stored report was built. Null when the report has no launched row.
+ *
+ * @param array<string, mixed>|null $report Stored report.
+ */
+ public static function checked_while_live( ?array $report ): ?bool {
+ if ( null === $report ) {
+ return null;
+ }
+ $ok = array_column( is_array( $report['store_checks'] ?? null ) ? $report['store_checks'] : array(), 'ok', 'id' )['launched'] ?? null;
+ return null === $ok ? null : (bool) $ok;
+ }
+
/**
* Whether a scan ran none of these checks, and none is still waiting for one: the store showed
- * its coming soon page, or its host stopped it from opening its own pages.
+ * its coming soon page, or its host stopped it from opening its own pages. A check that had no
+ * product page to open is waiting for a product, not blocked.
*
- * @param array<int, array{ok:bool|null,pending?:bool}> $checks The question's checks.
+ * @param array<int, array{ok:bool|null,pending?:bool,no_product?:bool}> $checks The question's checks.
*/
public static function none_ran( array $checks ): bool {
- return array() !== $checks && array() === array_filter( $checks, static fn( array $check ): bool => null !== $check['ok'] || ! empty( $check['pending'] ) );
+ return array() !== $checks && array() === array_filter( $checks, static fn( array $check ): bool => null !== $check['ok'] || ! empty( $check['pending'] ) || ! empty( $check['no_product'] ) );
}
/**
* The row that stands in for a question's scanned checks when none of them could run, saying why.
*
- * @param bool $launched Whether the store is launched.
+ * @param bool $launched Whether the store is launched now.
+ * @param bool|null $was_live Whether the store was live when it was checked.
* @return array<string, mixed>
*/
- private static function cant_check_row( bool $launched ): array {
- $copy = self::cant_check_copy( $launched );
- return self::row( 'cant_check', 'unknown', $copy[0], $copy[1] );
+ private static function cant_check_row( bool $launched, ?bool $was_live = null ): array {
+ $copy = self::cant_check_copy( $launched, $was_live );
+ return array( 'waiting' => self::checks_waiting( $launched, $was_live ) ) + self::row( 'cant_check', 'unknown', $copy[0], $copy[1] );
}
/**
* Why none of the scanned checks ran, as a title and a line. The support report says the same.
*
- * @param bool $launched Whether the store is launched.
+ * @param bool $launched Whether the store is launched now.
+ * @param bool|null $was_live Whether the store was live when it was checked.
* @return array{0:string,1:string}
*/
- public static function cant_check_copy( bool $launched ): array {
- return $launched
- ? array( __( 'Your pages couldn’t be checked', 'woocommerce' ), __( 'Your hosting setup blocked the check from opening them. Checks run again each day. If this keeps happening, contact your hosting provider.', 'woocommerce' ) )
- : array( __( 'Your store is in coming soon mode', 'woocommerce' ), __( 'These checks run once your store is live.', 'woocommerce' ) );
+ public static function cant_check_copy( bool $launched, ?bool $was_live = null ): array {
+ if ( ! $launched ) {
+ return array( __( 'Your store is in coming soon mode', 'woocommerce' ), __( 'These checks run once your store is live.', 'woocommerce' ) );
+ }
+ // Checked in coming soon mode, then the store went live: nothing was blocked; the checks haven't run since.
+ if ( false === $was_live ) {
+ return array( __( 'Your store wasn’t live at the last check', 'woocommerce' ), __( 'These checks run at the next daily check, or you can run the check again now.', 'woocommerce' ) );
+ }
+ return array( __( 'Your pages couldn’t be checked', 'woocommerce' ), __( 'Your hosting setup blocked the check from opening them. Checks run again each day. If this keeps happening, contact your hosting provider.', 'woocommerce' ) );
+ }
+
+ /**
+ * Whether unchecked rows wait for the merchant (coming soon, or a check from before the store went live).
+ *
+ * @param bool $launched Whether the store is launched now.
+ * @param bool|null $was_live Whether the store was live when it was checked.
+ */
+ private static function checks_waiting( bool $launched, ?bool $was_live ): bool {
+ return ! $launched || false === $was_live;
+ }
+
+ /**
+ * Why one check has no result, for its row and the support report: coming soon, checked before
+ * the store went live, no product page to check, or it couldn't run.
+ *
+ * @param array{no_product?:bool} $check Store check with no result.
+ * @param bool $launched Whether the store is launched now.
+ * @param bool|null $was_live Whether the store was live when it was checked.
+ * @return array{0:bool,1:string} Whether the check waits for the merchant (Not checked yet), and why.
+ */
+ public static function unchecked_copy( array $check, bool $launched, ?bool $was_live ): array {
+ if ( ! $launched ) {
+ return array( true, __( 'Launch your store to run this check.', 'woocommerce' ) );
+ }
+ if ( false === $was_live ) {
+ return array( true, __( 'Your store wasn’t live at the last check. This check runs at the next daily check, or you can run the check again now.', 'woocommerce' ) );
+ }
+ if ( ! empty( $check['no_product'] ) ) {
+ return array( true, __( 'This check needs a product page. It runs once you have a published product that AI assistants can see.', 'woocommerce' ) );
+ }
+ return array( false, __( 'This check couldn’t run. It runs again each day, or you can run the check again now.', 'woocommerce' ) );
}
/**
@@ -1056,7 +1117,7 @@ class ReadinessCheckPage implements RegisterHooksInterface {
*/
private static function failing_product_names( string $check_id ): array {
return array_map(
- static fn( int $id ): string => html_entity_decode( wp_strip_all_tags( get_the_title( $id ) ), ENT_QUOTES, 'UTF-8' ),
+ static fn( int $id ): string => self::product_name( $id ),
self::failing_product_ids( $check_id, ReadinessCopy::NAMED_MAX + 1 )
);
}
@@ -1095,24 +1156,27 @@ class ReadinessCheckPage implements RegisterHooksInterface {
/**
* Protocols and files the store serves to agents, as information, never pass or fail: how many were
- * found, then every item under where it lives. Items the scan couldn't read are under Not checked yet.
- * Null with no items in the report.
+ * found, then every item under where it lives. Items the scan couldn't read are under Couldn't check,
+ * or Not checked yet while the checks wait for the merchant. Null with no items in the report.
*
- * @param array $items Items from the report.
- * @return array{title:string,badge:array{intent:string,text:string},text:string,groups:array<int, array{title:string,items:array<int, array{name:string,found:bool|null}>}>}|null
+ * @param array $items Items from the report.
+ * @param bool|null $launched Whether the store is launched now.
+ * @param bool|null $was_live Whether the store was live when it was checked.
+ * @return array{title:string,badge:array{intent:string,text:string},text:string,waiting:bool,groups:array<int, array{title:string,items:array<int, array{name:string,found:bool|null}>}>}|null
*/
- private static function declared( array $items ): ?array {
+ private static function declared( array $items, ?bool $launched = true, ?bool $was_live = true ): ?array {
$items = array_values( array_filter( $items, 'is_array' ) );
if ( array() === $items ) {
return null;
}
- $titles = array(
+ $waiting = self::checks_waiting( (bool) $launched, $was_live );
+ $titles = array(
'root' => __( 'Files in your root folder', 'woocommerce' ),
'address' => __( 'Files at standard addresses', 'woocommerce' ),
'code' => __( 'In your page code', 'woocommerce' ),
- 'unknown' => __( 'Not checked yet', 'woocommerce' ),
+ 'unknown' => $waiting ? __( 'Not checked yet', 'woocommerce' ) : __( 'Couldn’t check', 'woocommerce' ),
);
- $groups = array();
+ $groups = array();
foreach ( $items as $item ) {
$found = $item['found'] ?? null;
$group = null === $found ? 'unknown' : DeclaredToAgents::group( (string) ( $item['id'] ?? '' ) );
@@ -1146,11 +1210,13 @@ class ReadinessCheckPage implements RegisterHooksInterface {
}
}
return array(
- 'title' => __( 'Extra details for AI assistants', 'woocommerce' ),
- 'badge' => self::badge_data( array( 'off', __( 'Optional', 'woocommerce' ) ) ),
- 'text' => $text,
+ 'title' => __( 'Extra details for AI assistants', 'woocommerce' ),
+ 'badge' => self::badge_data( array( 'off', __( 'Optional', 'woocommerce' ) ) ),
+ 'text' => $text,
+ // Unread items wait for the merchant, rather than having failed to load.
+ 'waiting' => $waiting,
// In the order of $titles, leaving out the groups with no items.
- 'groups' => array_map(
+ 'groups' => array_map(
static fn( string $key ): array => array(
'title' => $titles[ $key ],
'items' => $groups[ $key ],
@@ -1161,13 +1227,15 @@ class ReadinessCheckPage implements RegisterHooksInterface {
}
/**
- * The badge on a question: how many issues, that everything passed, or Not checked yet, before the
- * first check or when nothing failed but a check couldn't run (its row says why).
+ * The badge on a question: how many issues, that everything passed, or, when nothing failed but a check
+ * couldn't run (its row says why), Couldn't check. Not checked yet while the checks wait for the merchant:
+ * in coming soon mode, or with nothing to check, such as Store access while AI shopping is off.
*
- * @param array<int, array{ok:bool|null}> $checks The question's checks.
+ * @param array<int, array{ok:bool|null,no_product?:bool}> $checks The question's checks.
+ * @param bool $waiting Whether the checks wait for the merchant, as in coming soon mode.
* @return array{0:string,1:string} Badge class and text.
*/
- private static function group_badge( array $checks ): array {
+ private static function group_badge( array $checks, bool $waiting = false ): array {
$issues = count( array_filter( $checks, static fn( array $check ): bool => false === $check['ok'] ) );
if ( $issues > 0 ) {
/* translators: %d: number of issues. */
@@ -1177,15 +1245,27 @@ class ReadinessCheckPage implements RegisterHooksInterface {
if ( $passed > 0 && count( $checks ) === $passed ) {
return array( 'info', __( 'All passed', 'woocommerce' ) );
}
- return self::cant_check_badge();
+ // Only checks still waiting for a product are unchecked: they wait for the merchant too.
+ $waiting = $waiting || array() === array_filter( $checks, static fn( array $check ): bool => null === $check['ok'] && empty( $check['no_product'] ) );
+ return $waiting ? self::waiting_badge() : self::cant_check_badge();
}
/**
- * The Not checked yet badge, on a question where nothing failed but a check couldn't run, or before the first check.
+ * The Couldn't check badge, on a question where nothing failed but a check tried to run and couldn't.
*
* @return array{0:string,1:string} Badge class and text.
*/
private static function cant_check_badge(): array {
+ return array( 'off', __( 'Couldn’t check', 'woocommerce' ) );
+ }
+
+ /**
+ * The Not checked yet badge, while a question's checks wait for the merchant: the store to go live,
+ * a check from before launch to run again, AI shopping to be on, or products to check.
+ *
+ * @return array{0:string,1:string} Badge class and text.
+ */
+ private static function waiting_badge(): array {
return array( 'off', __( 'Not checked yet', 'woocommerce' ) );
}
@@ -1197,9 +1277,10 @@ class ReadinessCheckPage implements RegisterHooksInterface {
*
* @param array<int, array{id:string,ok:bool|null,blocks:string,level:string,name:string,label?:string,why:string,fix:string,fix_url:string,conflict?:bool,seen_at?:string,source?:string}> $checks Checks.
* @param bool|null $launched Whether the store is launched.
+ * @param bool|null $was_live Whether the store was live when it was checked.
* @return array<int, array<string, mixed>>
*/
- private static function check_rows( array $checks, ?bool $launched ): array {
+ private static function check_rows( array $checks, ?bool $launched, ?bool $was_live = true ): array {
$rows = array();
foreach ( $checks as $check ) {
$step = self::is_setup_step( $check ) ? self::passed_step( $check ) : null;
@@ -1210,7 +1291,8 @@ class ReadinessCheckPage implements RegisterHooksInterface {
if ( null === $check['ok'] ) {
// The title says what the check looks for, not that it passed.
$title = ReadinessCopy::store_check( $check['id'] )['action'] ?? $copy['title'] ?? $check['name'];
- $rows[] = self::row( $check['id'], 'unknown', $title, $launched ? __( 'This check couldn’t run. It runs again each day, or you can run the check again now.', 'woocommerce' ) : __( 'Launch your store to run this check.', 'woocommerce' ) );
+ $why = self::unchecked_copy( $check, false !== $launched, $was_live );
+ $rows[] = array( 'waiting' => $why[0] ) + self::row( $check['id'], 'unknown', $title, $why[1] );
continue;
}
if ( $check['ok'] ) {
@@ -1303,6 +1385,8 @@ class ReadinessCheckPage implements RegisterHooksInterface {
// products counts only what the scan can check. Hidden and unsupported products are counted apart, so they are not an empty store.
$no_products = isset( $report['products'] ) && 0 === (int) $report['products'];
$unreadable = $no_products && ( (int) ( $report['hidden_from_catalog'] ?? 0 ) > 0 || (int) ( $report['unsupported_types'] ?? 0 ) > 0 );
+ $was_live = self::checked_while_live( $report );
+ $waiting = self::checks_waiting( $launched, $was_live );
foreach ( self::question_groups( $checks ) as $id => $group ) {
if ( 'buy' === $id ) {
$sections[] = $no_products ? self::no_products_section( 'products', self::products_question(), $unreadable ) : $this->product_section( $report );
@@ -1312,19 +1396,29 @@ class ReadinessCheckPage implements RegisterHooksInterface {
continue;
}
// When no check could run, one row says why in their place.
- $cant = array() !== $report && self::none_ran( $group[1] );
- $checks = $cant ? array() : $group[1];
- $folded = array_filter( $checks, static fn( array $check ): bool => true === $check['ok'] );
- $rows = self::check_rows( array_values( array_diff_key( $checks, $folded ) ), $launched );
+ $cant = array() !== $report && self::none_ran( $group[1] );
+ $checks = $cant ? array() : $group[1];
+ $folded = array_filter( $checks, static fn( array $check ): bool => true === $check['ok'] );
+ $rows = self::check_rows( array_values( array_diff_key( $checks, $folded ) ), $launched, $was_live );
+ $ucp_off = 'access' === $id && ! UcpUtils::is_enabled();
+ // With AI shopping off, Store access may have nothing left to show: say what turning it on checks.
+ $ucp_only = $ucp_off && array() !== $report && ! $cant && array() === $checks;
$sections[] = array(
'id' => $id,
'title' => $group[0],
- 'badge' => self::badge_data( $cant && array() === $rows ? self::cant_check_badge() : self::group_badge( $checks ) ),
- 'note' => 'access' === $id && ! UcpUtils::is_enabled() ? self::ucp_off_note() : ( 'understand' === $id ? self::sample_note( $report ) : null ),
+ 'badge' => self::badge_data( $cant && array() === $rows ? ( $waiting ? self::waiting_badge() : self::cant_check_badge() ) : self::group_badge( $checks, $waiting ) ),
+ 'note' => $ucp_off && ! $ucp_only ? self::ucp_off_note() : ( 'understand' === $id ? self::sample_note( $report ) : null ),
'channels' => array(),
- 'rows' => $cant ? array_merge( $rows, array( self::cant_check_row( $launched ) ) ) : $rows,
- 'folded' => self::check_rows( array_values( $folded ), $launched ),
- 'empty' => null,
+ 'rows' => $cant ? array_merge( $rows, array( self::cant_check_row( $launched, $was_live ) ) ) : $rows,
+ 'folded' => self::check_rows( array_values( $folded ), $launched, $was_live ),
+ 'empty' => $ucp_only ? array(
+ 'title' => __( 'These checks run once AI shopping is on, like whether AI assistants can connect to your store and send shoppers to your checkout.', 'woocommerce' ),
+ 'text' => '',
+ 'link' => array(
+ 'href' => AgenticCommerceSettings::url( AgenticCommerceSettings::SHOPPING_SECTION ),
+ 'text' => __( 'Turn on AI shopping', 'woocommerce' ),
+ ),
+ ) : null,
);
}
return $sections;
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessRestController.php b/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessRestController.php
index 5730bbd10f9..ff67e164d18 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessRestController.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessRestController.php
@@ -3,7 +3,6 @@ declare( strict_types = 1 );
namespace Automattic\WooCommerce\Internal\AgentReadiness;
-use Automattic\WooCommerce\Internal\Features\FeaturesController;
use Automattic\WooCommerce\Internal\RestApiControllerBase;
use WP_REST_Request;
@@ -19,18 +18,10 @@ defined( 'ABSPATH' ) || exit;
* the AI tools Overview what they show, and GET wc/v3/agent-readiness/support-report
* gives the text file a merchant sends to support.
*
- * Registered only while the agent_readiness feature is enabled.
- *
* @since 11.4.0
*/
class ReadinessRestController extends RestApiControllerBase {
- /**
- * Features controller.
- *
- * @var FeaturesController
- */
- private FeaturesController $features_controller;
/**
* Readiness service.
@@ -72,20 +63,18 @@ class ReadinessRestController extends RestApiControllerBase {
*
* @internal
*
- * @param FeaturesController $features_controller Features controller.
* @param AgentReadiness $agent_readiness Readiness service.
* @param ScheduledScan $scheduled_scan Background scan.
* @param UcpSwitch $ucp_switch UCP switch.
* @param ReadinessCheckPage $readiness_page Sales readiness.
* @param SupportReport|null $support_report Text report for support; resolved from the container when omitted.
*/
- final public function init( FeaturesController $features_controller, AgentReadiness $agent_readiness, ScheduledScan $scheduled_scan, UcpSwitch $ucp_switch, ReadinessCheckPage $readiness_page, ?SupportReport $support_report = null ): void {
- $this->features_controller = $features_controller;
- $this->agent_readiness = $agent_readiness;
- $this->scheduled_scan = $scheduled_scan;
- $this->ucp_switch = $ucp_switch;
- $this->readiness_page = $readiness_page;
- $this->support_report = $support_report ?? wc_get_container()->get( SupportReport::class );
+ final public function init( AgentReadiness $agent_readiness, ScheduledScan $scheduled_scan, UcpSwitch $ucp_switch, ReadinessCheckPage $readiness_page, ?SupportReport $support_report = null ): void {
+ $this->agent_readiness = $agent_readiness;
+ $this->scheduled_scan = $scheduled_scan;
+ $this->ucp_switch = $ucp_switch;
+ $this->readiness_page = $readiness_page;
+ $this->support_report = $support_report ?? wc_get_container()->get( SupportReport::class );
}
/**
@@ -99,9 +88,6 @@ class ReadinessRestController extends RestApiControllerBase {
* Register the routes.
*/
public function register_routes(): void {
- if ( ! $this->features_controller->feature_is_enabled( AgenticCommerceSettings::FEATURE_ID ) ) {
- return;
- }
register_rest_route(
$this->route_namespace,
'/agent-readiness',
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/ReportAbility.php b/plugins/woocommerce/src/Internal/AgentReadiness/ReportAbility.php
index ff8c76db4fa..c8a1a58a5f7 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/ReportAbility.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/ReportAbility.php
@@ -9,7 +9,6 @@ defined( 'ABSPATH' ) || exit;
/**
* Ability that reads the readiness report, for AbilitiesLoader.
- * No name while the feature is disabled, so the loader skips it.
*
* @since 11.4.0
*/
@@ -20,12 +19,12 @@ class ReportAbility implements AbilityDefinition {
public const NAME = 'woocommerce/get-agent-readiness';
/**
- * Ability name, or an empty string while the feature is disabled.
+ * Ability name.
*
* @return string
*/
public static function get_name(): string {
- return self::name_when_enabled( self::NAME );
+ return self::NAME;
}
/**
@@ -40,9 +39,8 @@ class ReportAbility implements AbilityDefinition {
'category' => 'woocommerce',
'input_schema' => array(
'type' => 'object',
- 'properties' => array(),
- 'additionalProperties' => false,
'default' => array(),
+ 'additionalProperties' => false,
),
'output_schema' => self::output_schema(),
'execute_callback' => array( self::class, 'execute' ),
@@ -66,17 +64,19 @@ class ReportAbility implements AbilityDefinition {
* The stored report with store checks as they stand now, whether a scan is pending, and whether it has stalled.
*
* @param array<string, mixed> $input Ability input; this ability takes none.
- * @return array{report:array<string,mixed>|null,scan_pending:bool,scan_stalled:bool}
+ * @return array<string, mixed> The report (left out before the first scan), scan_pending and scan_stalled.
*/
public static function execute( array $input ): array {
unset( $input );
$readiness = wc_get_container()->get( AgentReadiness::class );
$scan = wc_get_container()->get( ScheduledScan::class );
$pending = $scan->is_pending();
- return array(
- 'report' => $readiness->get_served_report(),
- 'scan_pending' => $pending,
- 'scan_stalled' => $pending && $scan->is_stalled(),
+ return self::without_nulls(
+ array(
+ 'report' => $readiness->get_served_report(),
+ 'scan_pending' => $pending,
+ 'scan_stalled' => $pending && $scan->is_stalled(),
+ )
);
}
@@ -91,8 +91,8 @@ class ReportAbility implements AbilityDefinition {
'type' => 'object',
'properties' => array(
'report' => array(
- 'type' => array( 'object', 'null' ),
- 'description' => __( 'The last agent readiness check, or null before the first one.', 'woocommerce' ),
+ 'type' => 'object',
+ 'description' => __( 'The last agent readiness check. Left out before the first one.', 'woocommerce' ),
'properties' => array(
'generated_at' => array(
'type' => 'string',
@@ -119,50 +119,54 @@ class ReportAbility implements AbilityDefinition {
'items' => array(
'type' => 'object',
'properties' => array(
- 'id' => array( 'type' => 'string' ),
- 'ok' => array(
- 'type' => array( 'boolean', 'null' ),
- 'description' => __( 'True when the store passes, false when it fails, null when the check could not run.', 'woocommerce' ),
+ 'id' => array( 'type' => 'string' ),
+ 'ok' => array(
+ 'type' => 'boolean',
+ 'description' => __( 'True when the store passes, false when it fails. Left out when the check could not run.', 'woocommerce' ),
),
- 'group' => array(
+ 'group' => array(
'type' => 'string',
'enum' => array( 'access', 'find', 'understand', 'buy', '' ),
'description' => __( 'The question the check answers: access (can agents get in), find (can they find the store), understand (do they understand the products) or buy (can they buy). Empty in a report from before checks had a group.', 'woocommerce' ),
),
- 'blocks' => array(
+ 'blocks' => array(
'type' => 'string',
'description' => __( 'What a failure stops: listing (every product everywhere), discovery (harder for agents to find and read the store), ucp (agents using UCP) or checkout (agent orders).', 'woocommerce' ),
),
- 'level' => array(
+ 'level' => array(
'type' => 'string',
'enum' => array( StoreConditions::LEVEL_REQUIRED, StoreConditions::LEVEL_RECOMMENDED ),
),
- 'name' => array( 'type' => 'string' ),
- 'label' => array( 'type' => 'string' ),
- 'why' => array( 'type' => 'string' ),
- 'fix' => array( 'type' => 'string' ),
- 'fix_url' => array( 'type' => 'string' ),
- 'conflict' => array(
+ 'name' => array( 'type' => 'string' ),
+ 'label' => array( 'type' => 'string' ),
+ 'why' => array( 'type' => 'string' ),
+ 'fix' => array( 'type' => 'string' ),
+ 'fix_url' => array( 'type' => 'string' ),
+ 'conflict' => array(
'type' => 'boolean',
'description' => __( 'On output checks: true only when the check failed and the store is set to send this, so something else is likely replacing it.', 'woocommerce' ),
),
- 'pending' => array(
+ 'pending' => array(
'type' => 'boolean',
'description' => __( 'On output checks: true for a check of output a coming WooCommerce update builds; it does not run yet.', 'woocommerce' ),
),
- 'skipped' => array(
+ 'skipped' => array(
'type' => 'boolean',
'description' => __( 'On output checks: true when none of the products checked has the detail, such as a barcode, so there was nothing to check.', 'woocommerce' ),
),
- 'seen_at' => array(
+ 'no_product' => array(
+ 'type' => 'boolean',
+ 'description' => __( 'On output checks: true when the check reads a product page and the store had no product it could check, so it did not run.', 'woocommerce' ),
+ ),
+ 'seen_at' => array(
'type' => 'string',
'description' => __( 'On a likely conflict: the address where it was seen. On a broken llms.txt link: that link. On a UCP endpoint check that didn\'t pass: the catalog search address that answered.', 'woocommerce' ),
),
- 'source' => array(
+ 'source' => array(
'type' => 'string',
'description' => __( 'On a failed UCP version check: the version the store serves. On a UCP endpoint check that didn\'t pass: the status and content type catalog search answered with, such as 403 text/html. On the llms.txt check: woocommerce, file or other when served; disabled or not_reached when not. Otherwise empty.', 'woocommerce' ),
),
- 'product' => array(
+ 'product' => array(
'type' => 'integer',
'description' => __( 'On a failed check of product pages: the ID of the product whose page failed. The check reads up to five product pages, the best seller first, and stops at the first that fails. Otherwise 0.', 'woocommerce' ),
),
@@ -199,8 +203,8 @@ class ReportAbility implements AbilityDefinition {
'items' => array( 'type' => 'integer' ),
),
'sales_share' => array(
- 'type' => array( 'number', 'null' ),
- 'description' => __( 'Share of the store\'s net sales, from 0 to 1, on the products that fail this check, over the period in sales. Null when Analytics is off or the period has fewer than 20 orders, too few to rank by.', 'woocommerce' ),
+ 'type' => 'number',
+ 'description' => __( 'Share of the store\'s net sales, from 0 to 1, on the products that fail this check, over the period in sales. Left out when Analytics is off or the period has fewer than 20 orders, too few to rank by.', 'woocommerce' ),
),
'fix_url' => array( 'type' => 'string' ),
),
@@ -214,7 +218,10 @@ class ReportAbility implements AbilityDefinition {
'properties' => array(
'id' => array( 'type' => 'string' ),
'name' => array( 'type' => 'string' ),
- 'found' => array( 'type' => array( 'boolean', 'null' ) ),
+ 'found' => array(
+ 'type' => 'boolean',
+ 'description' => __( 'Whether the store declares it. Left out when it could not be checked.', 'woocommerce' ),
+ ),
),
),
),
@@ -224,8 +231,8 @@ class ReportAbility implements AbilityDefinition {
'description' => __( 'Whether the up to five product pages the page checks read start with the best seller. False when they start with the newest product.', 'woocommerce' ),
),
'sales' => array(
- 'type' => array( 'object', 'null' ),
- 'description' => __( 'The sales the shares compare: the last days, from Analytics, how many orders, and whether Analytics has imported the store\'s orders for that period. Null while Analytics is off.', 'woocommerce' ),
+ 'type' => 'object',
+ 'description' => __( 'The sales the shares compare: the last days, from Analytics, how many orders, and whether Analytics has imported the store\'s orders for that period. Left out while Analytics is off.', 'woocommerce' ),
'properties' => array(
'days' => array( 'type' => 'integer' ),
'orders' => array( 'type' => 'integer' ),
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/RunCheckAbility.php b/plugins/woocommerce/src/Internal/AgentReadiness/RunCheckAbility.php
index 50f8f95b73f..dff0cafd861 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/RunCheckAbility.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/RunCheckAbility.php
@@ -9,7 +9,6 @@ defined( 'ABSPATH' ) || exit;
/**
* Ability that checks a product again or queues a store check, for AbilitiesLoader.
- * No name while the feature is disabled, so the loader skips it.
*
* @since 11.4.0
*/
@@ -20,12 +19,12 @@ class RunCheckAbility implements AbilityDefinition {
public const NAME = 'woocommerce/run-agent-readiness-check';
/**
- * Ability name, or an empty string while the feature is disabled.
+ * Ability name.
*
* @return string
*/
public static function get_name(): string {
- return self::name_when_enabled( self::NAME );
+ return self::NAME;
}
/**
@@ -82,10 +81,12 @@ class RunCheckAbility implements AbilityDefinition {
$report = wc_get_container()->get( AgentReadiness::class )->get_cached_report();
$pending = $scan->is_pending();
$generated_at = is_array( $report ) ? ( $report['generated_at'] ?? null ) : null;
- return array(
- 'scan_pending' => $pending,
- 'scan_stalled' => $pending && $scan->is_stalled(),
- 'report_generated_at' => is_string( $generated_at ) ? $generated_at : null,
+ return self::without_nulls(
+ array(
+ 'scan_pending' => $pending,
+ 'scan_stalled' => $pending && $scan->is_stalled(),
+ 'report_generated_at' => is_string( $generated_at ) ? $generated_at : null,
+ )
);
}
@@ -137,8 +138,8 @@ class RunCheckAbility implements AbilityDefinition {
'description' => __( 'Whole store: whether the queued check has not started because scheduled actions are not running on the store. It runs once they do; until then the report does not change.', 'woocommerce' ),
),
'report_generated_at' => array(
- 'type' => array( 'string', 'null' ),
- 'description' => __( 'Whole store: when the report agents can read now was made; it changes when the queued check finishes.', 'woocommerce' ),
+ 'type' => 'string',
+ 'description' => __( 'Whole store: when the report agents can read now was made; it changes when the queued check finishes. Left out before the first check.', 'woocommerce' ),
),
'product' => array(
'type' => 'object',
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/ScheduledScan.php b/plugins/woocommerce/src/Internal/AgentReadiness/ScheduledScan.php
index 63d6e06b078..02c25829bda 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/ScheduledScan.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/ScheduledScan.php
@@ -3,7 +3,6 @@ declare( strict_types = 1 );
namespace Automattic\WooCommerce\Internal\AgentReadiness;
-use Automattic\WooCommerce\Internal\Features\FeaturesController;
use Automattic\WooCommerce\Internal\RegisterHooksInterface;
use Automattic\WooCommerce\Internal\Utilities\ActionSchedulerUtil;
@@ -16,8 +15,8 @@ defined( 'ABSPATH' ) || exit;
* Each run schedules the next one a day later, so nothing is queued until a
* merchant or the REST API asks for the first scan, and no request pays for a
* scheduling check. The next run is scheduled before the scan, so a scan that
- * fails or times out does not end the chain; a run that finds the feature
- * disabled does.
+ * fails or times out does not end the chain. Cancelling the scheduled actions
+ * under Tools > Scheduled Actions stops the chain until the next manual check.
*
* A requested scan that has not started 10 minutes after it was due, while no
* other scheduled action has finished either, is taken as stalled (Action
@@ -55,12 +54,6 @@ class ScheduledScan implements RegisterHooksInterface {
*/
public const RUNNING_FOR = 10 * MINUTE_IN_SECONDS;
- /**
- * Features controller.
- *
- * @var FeaturesController
- */
- private FeaturesController $features_controller;
/**
* Readiness service.
@@ -81,14 +74,12 @@ class ScheduledScan implements RegisterHooksInterface {
*
* @internal
*
- * @param FeaturesController $features_controller Features controller.
- * @param AgentReadiness $agent_readiness Readiness service.
- * @param RemoteRules $remote_rules Rules from the published rules file.
+ * @param AgentReadiness $agent_readiness Readiness service.
+ * @param RemoteRules $remote_rules Rules from the published rules file.
*/
- final public function init( FeaturesController $features_controller, AgentReadiness $agent_readiness, RemoteRules $remote_rules ): void {
- $this->features_controller = $features_controller;
- $this->agent_readiness = $agent_readiness;
- $this->remote_rules = $remote_rules;
+ final public function init( AgentReadiness $agent_readiness, RemoteRules $remote_rules ): void {
+ $this->agent_readiness = $agent_readiness;
+ $this->remote_rules = $remote_rules;
}
/**
@@ -175,9 +166,6 @@ class ScheduledScan implements RegisterHooksInterface {
* @internal
*/
public function run(): void {
- if ( ! $this->features_controller->feature_is_enabled( AgenticCommerceSettings::FEATURE_ID ) ) {
- return;
- }
as_unschedule_all_actions( self::DAILY_HOOK, array(), self::GROUP );
as_schedule_single_action( time() + DAY_IN_SECONDS, self::DAILY_HOOK, array(), self::GROUP );
@@ -195,11 +183,6 @@ class ScheduledScan implements RegisterHooksInterface {
*/
public function run_batch( $chain = '' ): void {
$chain = is_string( $chain ) ? $chain : '';
- if ( ! $this->features_controller->feature_is_enabled( AgenticCommerceSettings::FEATURE_ID ) ) {
- $this->agent_readiness->cancel_refresh();
- as_unschedule_all_actions( self::NEXT_HOOK );
- return;
- }
// Runs only if this action ends early, as on a timeout, and goes on from the last finished batch.
as_schedule_single_action( time() + self::RETRY_AFTER, self::NEXT_HOOK, array( $chain ), self::GROUP );
$more = $this->agent_readiness->continue_refresh( $chain );
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/StoreOutputChecks.php b/plugins/woocommerce/src/Internal/AgentReadiness/StoreOutputChecks.php
index 58f8af70b8b..e45ded0987f 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/StoreOutputChecks.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/StoreOutputChecks.php
@@ -64,7 +64,7 @@ class StoreOutputChecks {
* A likely conflict also names the address where it was seen. It doesn't name a plugin: any list of
* plugins goes stale, and several can change the same output.
*
- * @return array<int, array{id:string,ok:bool|null,blocks:string,group:string,level:string,name:string,label:string,why:string,fix:string,fix_url:string,conflict:bool,pending:bool,seen_at:string,source:string,product:int}>
+ * @return array<int, array{id:string,ok:bool|null,blocks:string,group:string,level:string,name:string,label:string,why:string,fix:string,fix_url:string,conflict:bool,pending:bool,no_product:bool,seen_at:string,source:string,product:int}>
*/
public function all(): array {
return $this->all_for( $this->responses() );
@@ -76,7 +76,7 @@ class StoreOutputChecks {
* @since 11.4.0
*
* @param StoreResponses $responses Responses of the scan.
- * @return array<int, array{id:string,ok:bool|null,blocks:string,group:string,level:string,name:string,label:string,why:string,fix:string,fix_url:string,conflict:bool,pending:bool,seen_at:string,source:string,product:int}>
+ * @return array<int, array{id:string,ok:bool|null,blocks:string,group:string,level:string,name:string,label:string,why:string,fix:string,fix_url:string,conflict:bool,pending:bool,no_product:bool,seen_at:string,source:string,product:int}>
*/
public function all_for( StoreResponses $responses ): array {
// The home page first: when it can't be reached, no other request is made.
@@ -126,23 +126,25 @@ class StoreOutputChecks {
$seen_at = $this->broken_llms_link;
}
$results[] = array(
- 'id' => $check['id'],
- 'ok' => $ok,
- 'blocks' => $check['blocks'],
- 'group' => $check['group'],
- 'level' => StoreConditions::LEVEL_RECOMMENDED,
- 'name' => $check['name'],
- 'label' => $check['label'],
- 'why' => $check['why'],
- 'fix' => ReadinessCopy::llms_txt_source( $source )['fix'] ?? $check['fix'],
- 'fix_url' => $check['fix_url'],
- 'conflict' => $conflict,
- 'pending' => $pending,
- 'skipped' => $skipped,
- 'seen_at' => $seen_at,
- 'source' => $source,
+ 'id' => $check['id'],
+ 'ok' => $ok,
+ 'blocks' => $check['blocks'],
+ 'group' => $check['group'],
+ 'level' => StoreConditions::LEVEL_RECOMMENDED,
+ 'name' => $check['name'],
+ 'label' => $check['label'],
+ 'why' => $check['why'],
+ 'fix' => ReadinessCopy::llms_txt_source( $source )['fix'] ?? $check['fix'],
+ 'fix_url' => $check['fix_url'],
+ 'conflict' => $conflict,
+ 'pending' => $pending,
+ 'skipped' => $skipped,
+ // Not checked rather than couldn't check: the check reads a product page and there was no product to open.
+ 'no_product' => $this->take_no_product_page() && null === $ok,
+ 'seen_at' => $seen_at,
+ 'source' => $source,
// The product whose page failed, 0 when the check doesn't read product pages or didn't fail on one.
- 'product' => null === $failed ? 0 : $failed->get_id(),
+ 'product' => null === $failed ? 0 : $failed->get_id(),
);
$responses->focus( null );
}
@@ -222,6 +224,13 @@ class StoreOutputChecks {
*/
private string $broken_llms_link = '';
+ /**
+ * Whether the check being run needed a product page and the scan had no product to open.
+ *
+ * @var bool
+ */
+ private bool $no_product_page = false;
+
/**
* Organization and the subtypes stores use for themselves.
*/
@@ -844,6 +853,9 @@ class StoreOutputChecks {
* @param callable $test Test, given the Product items.
*/
private function with_products( StoreResponses $responses, callable $test ): ?bool {
+ if ( $this->without_product( $responses ) ) {
+ return null;
+ }
$page = $responses->product_page();
if ( null === $page ) {
return null;
@@ -911,10 +923,36 @@ class StoreOutputChecks {
* @param callable $test Test, given the HTML.
*/
private function on_product_page( StoreResponses $responses, callable $test ): ?bool {
+ if ( $this->without_product( $responses ) ) {
+ return null;
+ }
$page = $responses->product_page();
return null === $page ? null : (bool) $test( $page['body'] );
}
+ /**
+ * Whether the scan has no product to open. If so, marks the check being run as waiting for one
+ * (Not checked yet) rather than couldn't check. Every check that reads the product page calls this first.
+ *
+ * @param StoreResponses $responses Store responses.
+ */
+ private function without_product( StoreResponses $responses ): bool {
+ if ( null !== $responses->product() ) {
+ return false;
+ }
+ $this->no_product_page = true;
+ return true;
+ }
+
+ /**
+ * Whether the check just run needed a product page with no product to open, then clear it for the next check.
+ */
+ private function take_no_product_page(): bool {
+ $needed = $this->no_product_page;
+ $this->no_product_page = false;
+ return $needed;
+ }
+
/**
* Run a test on the home page's HTML, or null when it couldn't be loaded.
*
@@ -2243,6 +2281,9 @@ class StoreOutputChecks {
*/
private function reviews_marked_up( StoreResponses $responses ): ?bool {
// The passes below load no page. Without a product page the rest of the card couldn't run, so neither does this.
+ if ( $this->without_product( $responses ) ) {
+ return null;
+ }
if ( null === $responses->product_page() ) {
return null;
}
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/SupportReport.php b/plugins/woocommerce/src/Internal/AgentReadiness/SupportReport.php
index f01d2bd7c68..5588852e405 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/SupportReport.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/SupportReport.php
@@ -211,14 +211,16 @@ class SupportReport {
$lines[] = 'Not checked yet';
return $lines;
}
- $shown = $this->readiness_page->shown_check_ids( $report, $live );
+ $shown = $this->readiness_page->shown_check_ids( $report, $live );
+ $launched = (bool) ( array_column( $live, 'ok', 'id' )['launched'] ?? true );
+ $was_live = ReadinessCheckPage::checked_while_live( $report );
if ( ReadinessCheckPage::none_ran( array_values( array_filter( $scanned, static fn( array $check ): bool => in_array( $check['id'], $shown, true ) ) ) ) ) {
- $copy = ReadinessCheckPage::cant_check_copy( (bool) ( array_column( $live, 'ok', 'id' )['launched'] ?? true ) );
+ $copy = ReadinessCheckPage::cant_check_copy( $launched, $was_live );
$lines[] = $copy[0] . '. ' . $copy[1];
$lines[] = '';
}
foreach ( $scanned as $check ) {
- $line = self::check_line( $check, ReadinessCheckPage::failing_text( $check ) );
+ $line = self::check_line( $check, ReadinessCheckPage::failing_text( $check ), $launched, $was_live );
if ( ! in_array( $check['id'], $shown, true ) ) {
$line .= ' (not shown on the page)';
}
@@ -230,12 +232,19 @@ class SupportReport {
/**
* One check: status, name and id, then what was found when it fails, where it was seen and what the store answered.
*
- * @param array<string, mixed> $check Store check.
- * @param string $found What was found, shown when it fails.
+ * A scanned check with no result says Not checked yet, and why, when the page shows it that way.
+ *
+ * @param array<string, mixed> $check Store check.
+ * @param string $found What was found, shown when it fails.
+ * @param bool $launched Whether the store is launched now; a scanned check's status depends on it.
+ * @param bool|null $was_live Whether the store was live when it was checked; null for setup steps.
*/
- private static function check_line( array $check, string $found ): string {
+ private static function check_line( array $check, string $found, bool $launched = true, ?bool $was_live = true ): string {
+ $unchecked = null === $check['ok'] && empty( $check['pending'] ) ? ReadinessCheckPage::unchecked_copy( $check, $launched, $was_live ) : array( false, '' );
if ( ! empty( $check['pending'] ) ) {
$status = 'Not available yet';
+ } elseif ( $unchecked[0] ) {
+ $status = 'Not checked yet. ' . $unchecked[1];
} elseif ( null === $check['ok'] ) {
$status = 'Couldn’t check';
} else {
@@ -304,7 +313,7 @@ class SupportReport {
$line .= ' ' . sprintf( 1 === $count ? '%s product' : '%s products', $count );
if ( array() !== $ids ) {
_prime_post_caches( $ids, false, false );
- $named = array_map( static fn( int $id ): string => sprintf( '%d (%s)', $id, wp_strip_all_tags( get_the_title( $id ) ) ), $ids );
+ $named = array_map( static fn( int $id ): string => sprintf( '%d (%s)', $id, ReadinessCheckPage::product_name( $id ) ), $ids );
$line .= '. Products: ' . implode( ', ', $named );
}
}
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/Telemetry.php b/plugins/woocommerce/src/Internal/AgentReadiness/Telemetry.php
index c230b7cf55a..0f36c94e2b8 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/Telemetry.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/Telemetry.php
@@ -7,7 +7,6 @@ declare( strict_types=1 );
namespace Automattic\WooCommerce\Internal\AgentReadiness;
-use Automattic\WooCommerce\Internal\Features\FeaturesController;
use Automattic\WooCommerce\Internal\RegisterHooksInterface;
defined( 'ABSPATH' ) || exit;
@@ -22,12 +21,6 @@ class Telemetry implements RegisterHooksInterface {
public const PROBLEM = 'problem';
public const UNKNOWN = 'unknown';
- /**
- * Feature flags.
- *
- * @var FeaturesController
- */
- private FeaturesController $features_controller;
/**
* Readiness report.
@@ -41,12 +34,10 @@ class Telemetry implements RegisterHooksInterface {
*
* @internal
*
- * @param FeaturesController $features_controller Feature flags.
- * @param AgentReadiness $agent_readiness Readiness report.
+ * @param AgentReadiness $agent_readiness Readiness report.
*/
- final public function init( FeaturesController $features_controller, AgentReadiness $agent_readiness ): void {
- $this->features_controller = $features_controller;
- $this->agent_readiness = $agent_readiness;
+ final public function init( AgentReadiness $agent_readiness ): void {
+ $this->agent_readiness = $agent_readiness;
}
/**
@@ -72,25 +63,22 @@ class Telemetry implements RegisterHooksInterface {
}
/**
- * The feature flag, when the last scan ran, whether it stopped at the product limit, and each check's status.
+ * When the last scan ran, whether it stopped at the product limit, and each check's status.
* The store conditions are read now; output and product checks are as the last scan left them.
* `ucp_search` counts the catalog search checks, to see how often they fail and whether the retry helps.
*
* @return array{feature_enabled:string,last_scan:string,truncated:string,store_checks:array<string,string>,product_checks:array<string,string>,ucp_search?:array{since:string,checks:int,first_try_failed:int,failed:int,no_answer:int,last_seen:string,last_seen_on:string,last_recovered:string,last_recovered_on:string}}
*/
public function snapshot(): array {
- $snapshot = array(
- 'feature_enabled' => 'no',
+ $snapshot = array(
+ // Always yes since the feature flag was removed; kept so readers of the snapshot keep working.
+ 'feature_enabled' => 'yes',
'last_scan' => '',
'truncated' => 'no',
'store_checks' => array(),
'product_checks' => array(),
);
- if ( ! $this->features_controller->feature_is_enabled( AgenticCommerceSettings::FEATURE_ID ) ) {
- return $snapshot;
- }
- $snapshot['feature_enabled'] = 'yes';
- $snapshot['ucp_search'] = StoreOutputChecks::search_counts();
+ $snapshot['ucp_search'] = StoreOutputChecks::search_counts();
// Setup steps are read now, so they are known before the first scan too.
$report = $this->agent_readiness->get_served_report();
diff --git a/plugins/woocommerce/src/Internal/Features/FeaturesController.php b/plugins/woocommerce/src/Internal/Features/FeaturesController.php
index cd3374390a3..c80529bbb65 100644
--- a/plugins/woocommerce/src/Internal/Features/FeaturesController.php
+++ b/plugins/woocommerce/src/Internal/Features/FeaturesController.php
@@ -662,19 +662,6 @@ class FeaturesController {
'skip_compatibility_checks' => true,
'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
),
- 'agent_readiness' => array(
- 'name' => __( 'Agent readiness', 'woocommerce' ),
- 'description' => __(
- 'Check products against the product data specs of AI shopping channels, and set up agentic commerce, under WooCommerce > Settings > AI tools.',
- 'woocommerce'
- ),
- 'enabled_by_default' => false,
- // Hidden while it is a preview.
- 'disable_ui' => true,
- 'is_experimental' => true,
- 'skip_compatibility_checks' => true,
- 'default_plugin_compatibility' => FeaturePluginCompatibility::COMPATIBLE,
- ),
'destroy-empty-sessions' => array(
'name' => __( 'Clear Customer Sessions When Empty', 'woocommerce' ),
'description' => __(
diff --git a/plugins/woocommerce/tests/php/src/Internal/Abilities/AbilitiesLoaderTest.php b/plugins/woocommerce/tests/php/src/Internal/Abilities/AbilitiesLoaderTest.php
index 11571dada24..847fc3fc22a 100644
--- a/plugins/woocommerce/tests/php/src/Internal/Abilities/AbilitiesLoaderTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/Abilities/AbilitiesLoaderTest.php
@@ -78,6 +78,8 @@ class AbilitiesLoaderTest extends \WC_Unit_Test_Case {
'woocommerce/system-status-tools-query',
'woocommerce/system-status-tool-run',
'woocommerce/payment-gateway-update',
+ 'woocommerce/get-agent-readiness',
+ 'woocommerce/run-agent-readiness-check',
);
/**
@@ -1334,6 +1336,14 @@ class AbilitiesLoaderTest extends \WC_Unit_Test_Case {
'first_name' => 'Denied',
),
),
+ 'get-agent-readiness' => array(
+ 'woocommerce/get-agent-readiness',
+ array(),
+ ),
+ 'run-agent-readiness-check' => array(
+ 'woocommerce/run-agent-readiness-check',
+ array(),
+ ),
);
}
diff --git a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/AgenticCommerceSettingsTest.php b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/AgenticCommerceSettingsTest.php
index b14bbb2c492..50ce3b1e6ff 100644
--- a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/AgenticCommerceSettingsTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/AgenticCommerceSettingsTest.php
@@ -51,7 +51,6 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
// On multisite only a super admin can choose the privacy policy page, as a single site's administrator can.
grant_super_admin( get_current_user_id() );
}
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'yes' );
delete_option( 'woocommerce_feature_ucp_enabled' );
$this->sut = wc_get_container()->get( AgenticCommerceSettings::class );
}
@@ -71,15 +70,10 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
}
/**
- * @testdox The tab is added only while the agent_readiness feature is enabled.
+ * @testdox The AI tools tab is added in the admin.
*/
- public function test_tab_only_with_feature_enabled(): void {
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'no' );
+ public function test_tab_added(): void {
remove_all_filters( 'woocommerce_get_settings_pages' );
- $this->sut->handle_init();
- $this->assertFalse( has_filter( 'woocommerce_get_settings_pages' ), 'No tab with the feature off' );
-
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'yes' );
update_option( 'woocommerce_feature_ucp_enabled', 'no' );
$this->sut->handle_init();
$pages = apply_filters( 'woocommerce_get_settings_pages', array() );
@@ -107,17 +101,12 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
}
/**
- * @testdox Sales readiness is added only while the agent_readiness feature is enabled, as a WooCommerce Admin page under WooCommerce, before Settings.
+ * @testdox Sales readiness is added as a WooCommerce Admin page under WooCommerce, before Settings.
*/
- public function test_readiness_page_only_with_feature_enabled(): void {
+ public function test_readiness_page_added(): void {
$page = wc_get_container()->get( ReadinessCheckPage::class );
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'no' );
remove_all_actions( 'admin_menu' );
$page->handle_init();
- $this->assertFalse( has_action( 'admin_menu', array( $page, 'handle_admin_menu' ) ), 'No page with the feature off' );
-
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'yes' );
- $page->handle_init();
$this->assertSame( ReadinessCheckPage::MENU_PRIORITY, has_action( 'admin_menu', array( $page, 'handle_admin_menu' ) ), 'After Reports (20), before Settings (50)' );
// The menu globals aren't rolled back between tests, so put them back after.
@@ -656,11 +645,19 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
}
/**
- * @testdox A check that couldn't run says why on its row; a card none of whose checks ran says why once, for coming soon mode or a host that blocks the store's own pages.
+ * @testdox A check that couldn't run says why on its row; a card none of whose checks ran says why once, for coming soon mode, a check from before launch, or a host that blocks the store's own pages.
*/
public function test_output_couldnt_check_message_follows_coming_soon(): void {
StoreConditionsTest::make_store_ready( $this );
- $sitemap = array(
+ $launched = static fn( bool $ok ): array => array(
+ 'id' => 'launched',
+ 'group' => 'access',
+ 'ok' => $ok,
+ 'level' => 'required',
+ 'name' => 'Store is launched',
+ 'fix_url' => '',
+ );
+ $sitemap = array(
'id' => 'sitemap_lists_products',
'group' => 'find',
'ok' => null,
@@ -668,7 +665,7 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
'name' => 'Sitemap lists your products',
'fix_url' => '',
);
- $robots = array(
+ $robots = array(
'id' => 'robots_txt',
'group' => 'find',
'ok' => true,
@@ -676,19 +673,72 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
'name' => 'Robots file allows AI assistants',
'fix_url' => '',
);
- update_option( AgentReadiness::REPORT_OPTION, array( 'store_checks' => array( $sitemap, $robots ) ), false );
+ update_option( AgentReadiness::REPORT_OPTION, array( 'store_checks' => array( $launched( true ), $sitemap, $robots ) ), false );
$this->assertSame( 'This check couldn’t run. It runs again each day, or you can run the check again now.', $this->row( 'Add a sitemap that lists your products' )['text'], 'Titled by what the check looks for, not as if it passed' );
- update_option( AgentReadiness::REPORT_OPTION, array( 'store_checks' => array( $sitemap, array( 'ok' => null ) + $robots ) ), false );
+ update_option( AgentReadiness::REPORT_OPTION, array( 'store_checks' => array( $launched( true ), $sitemap, array( 'ok' => null ) + $robots ) ), false );
$card = array_column( $this->view()['sections'], null, 'id' )['find'];
- $this->assertSame( 'Not checked yet', $card['badge']['text'] );
+ $this->assertSame( 'Couldn’t check', $card['badge']['text'], 'The store is live, so the check tried and couldn\'t' );
$this->assertSame( array( 'Your pages couldn’t be checked' ), array_column( $card['rows'], 'title' ), 'One row for the card, not one per check' );
+ $this->assertFalse( $card['rows'][0]['waiting'], 'Screen readers hear Couldn\'t check' );
$this->assertSame( 'Your hosting setup blocked the check from opening them. Checks run again each day. If this keeps happening, contact your hosting provider.', $card['rows'][0]['text'] );
update_option( 'woocommerce_coming_soon', 'yes' );
$card = array_column( $this->view()['sections'], null, 'id' )['find'];
$this->assertSame( 'Your store is in coming soon mode', $card['rows'][0]['title'] );
$this->assertSame( 'These checks run once your store is live.', $card['rows'][0]['text'] );
+ $this->assertSame( 'Not checked yet', $card['badge']['text'], 'In coming soon mode the checks wait for the store to go live' );
+ $this->assertTrue( $card['rows'][0]['waiting'], 'Screen readers hear Not checked yet' );
+
+ // Checked while coming soon, then launched: wait for the next check, don't blame hosting.
+ update_option( 'woocommerce_coming_soon', 'no' );
+ update_option( AgentReadiness::REPORT_OPTION, array( 'store_checks' => array( $launched( false ), $sitemap, array( 'ok' => null ) + $robots ) ), false );
+ $card = array_column( $this->view()['sections'], null, 'id' )['find'];
+ $this->assertSame( 'Your store wasn’t live at the last check', $card['rows'][0]['title'] );
+ $this->assertSame( 'These checks run at the next daily check, or you can run the check again now.', $card['rows'][0]['text'] );
+ $this->assertSame( 'Not checked yet', $card['badge']['text'], 'The checks wait for the next run after launch' );
+ $this->assertTrue( $card['rows'][0]['waiting'], 'Screen readers hear Not checked yet' );
+ }
+
+ /**
+ * @testdox After launch, a check left unchecked by a check in coming soon mode says Not checked yet, even when others in its question passed; a product page check with no product says it needs one.
+ */
+ public function test_unchecked_row_follows_launch_and_products(): void {
+ StoreConditionsTest::make_store_ready( $this );
+ $check = static fn( string $id, ?bool $ok, array $extra = array() ): array => $extra + array(
+ 'id' => $id,
+ 'group' => 'find',
+ 'ok' => $ok,
+ 'level' => 'recommended',
+ 'name' => $id,
+ 'fix_url' => '',
+ );
+ $rows = function (): array {
+ $card = array_column( $this->view()['sections'], null, 'id' )['find'];
+ return array( $card['badge']['text'], array_column( $card['rows'], null, 'id' ) );
+ };
+
+ update_option( AgentReadiness::REPORT_OPTION, array( 'store_checks' => array( $check( 'launched', false, array( 'group' => 'access' ) ), $check( 'sitemap_lists_products', null ), $check( 'robots_txt', true ) ) ), false );
+ list( $badge, $by_id ) = $rows();
+ $this->assertSame( 'Not checked yet', $badge );
+ $this->assertTrue( $by_id['sitemap_lists_products']['waiting'], 'Screen readers hear Not checked yet' );
+ $this->assertSame( 'Your store wasn’t live at the last check. This check runs at the next daily check, or you can run the check again now.', $by_id['sitemap_lists_products']['text'] );
+
+ update_option( AgentReadiness::REPORT_OPTION, array( 'store_checks' => array( $check( 'launched', true, array( 'group' => 'access' ) ), $check( 'canonical_url', null, array( 'no_product' => true ) ), $check( 'robots_txt', true ) ) ), false );
+ list( $badge, $by_id ) = $rows();
+ $this->assertSame( 'Not checked yet', $badge, 'Waiting for a product, not a check that failed to run' );
+ $this->assertTrue( $by_id['canonical_url']['waiting'] );
+ $this->assertSame( 'This check needs a product page. It runs once you have a published product that AI assistants can see.', $by_id['canonical_url']['text'] );
+
+ update_option( AgentReadiness::REPORT_OPTION, array( 'store_checks' => array( $check( 'launched', true, array( 'group' => 'access' ) ), $check( 'canonical_url', null, array( 'no_product' => true ) ), $check( 'sitemap_lists_products', null ), $check( 'robots_txt', true ) ) ), false );
+ list( $badge, $by_id ) = $rows();
+ $this->assertSame( 'Couldn’t check', $badge, 'Another check tried and couldn\'t' );
+ $this->assertFalse( $by_id['sitemap_lists_products']['waiting'] );
+
+ update_option( AgentReadiness::REPORT_OPTION, array( 'store_checks' => array( $check( 'launched', true, array( 'group' => 'access' ) ), $check( 'canonical_url', null, array( 'no_product' => true ) ) ) ), false );
+ list( $badge, $by_id ) = $rows();
+ $this->assertSame( 'Not checked yet', $badge, 'Only a check waiting for a product: no hosting message' );
+ $this->assertArrayHasKey( 'canonical_url', $by_id );
}
/**
@@ -803,7 +853,11 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
array_column( $view['sections'], 'title' ),
'Listings come before Buying through AI assistants'
);
- $this->assertSame( 'Some checks only run when AI shopping is on, like whether AI assistants can connect to your store and send shoppers to your checkout.', $sections['access']['note'], 'UCP is off in this test' );
+ $this->assertNull( $sections['access']['note'], 'UCP is off and Store access has nothing else to check, so the card says what turning it on checks instead' );
+ $this->assertSame( 'These checks run once AI shopping is on, like whether AI assistants can connect to your store and send shoppers to your checkout.', $sections['access']['empty']['title'] );
+ $this->assertSame( 'Turn on AI shopping', $sections['access']['empty']['link']['text'] );
+ $this->assertSame( AgenticCommerceSettings::url( AgenticCommerceSettings::SHOPPING_SECTION ), $sections['access']['empty']['link']['href'], 'The button opens the page with the AI shopping switch' );
+ $this->assertSame( 'Not checked yet', $sections['access']['badge']['text'] );
$this->assertSame(
array(
'intent' => 'low',
@@ -913,14 +967,15 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
'Files in your root folder' => array( 'ai.txt usage file', 'AGENTS.md' ),
'Files at standard addresses' => array( 'API catalog' ),
'In your page code' => array( 'sameAs links', 'Markdown pages' ),
- 'Not checked yet' => array( 'TDMRep' ),
+ 'Couldn’t check' => array( 'TDMRep' ),
),
array_column( array_map( static fn( array $group ): array => array( $group['title'], array_column( $group['items'], 'name' ) ), $view['declared']['groups'] ), 1, 0 ),
- 'Every item, found or not, under where it lives; an item the scan couldn\'t read is under Not checked yet'
+ 'Every item, found or not, under where it lives; an item the scan couldn\'t read on a live store is under Couldn\'t check'
);
$groups = array_column( $view['declared']['groups'], 'items', 'title' );
$this->assertSame( array( true, false ), array_column( $groups['Files in your root folder'], 'found' ) );
- $this->assertNull( $groups['Not checked yet'][0]['found'], 'Not checked is neither found nor missing' );
+ $this->assertNull( $groups['Couldn’t check'][0]['found'], 'Not read is neither found nor missing' );
+ $this->assertFalse( $view['declared']['waiting'], 'The store is live, so an unread item couldn\'t be checked' );
$report = get_option( 'woocommerce_agent_readiness_report' );
$report['declared'] = array(
@@ -1462,20 +1517,21 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
}
/**
- * @testdox A question's badge counts its issues; when nothing failed but a check couldn't run, it says Not checked yet.
+ * @testdox A question's badge counts its issues; when nothing failed but a check couldn't run, it says Couldn't check, or Not checked yet while the checks wait for the merchant.
*/
public function test_group_badge(): void {
$badge = new \ReflectionMethod( ReadinessCheckPage::class, 'group_badge' );
$badge->setAccessible( true );
- $text = static fn( array $checks ): string => $badge->invoke( null, $checks )[1];
+ $text = static fn( array $checks, bool $waiting = false ): string => $badge->invoke( null, $checks, $waiting )[1];
$row = static fn( ?bool $ok ): array => array( 'ok' => $ok );
$this->assertSame( '2 issues', $text( array( $row( false ), $row( false ), $row( true ) ) ) );
$this->assertSame( '1 issue', $text( array( $row( false ), $row( null ) ) ) );
$this->assertSame( 'All passed', $text( array( $row( true ), $row( true ) ) ) );
- $this->assertSame( 'Not checked yet', $text( array( $row( true ), $row( null ) ) ), 'A check that could not run is not an issue, nor a pass' );
- $this->assertSame( 'Not checked yet', $text( array( $row( null ), $row( null ) ) ), 'Nothing ran, so nothing is shown as passed' );
- $this->assertSame( 'Not checked yet', $text( array() ) );
+ $this->assertSame( 'Couldn’t check', $text( array( $row( true ), $row( null ) ) ), 'A check that could not run is not an issue, nor a pass' );
+ $this->assertSame( 'Couldn’t check', $text( array( $row( null ), $row( null ) ) ), 'Nothing ran, so nothing is shown as passed' );
+ $this->assertSame( 'Not checked yet', $text( array( $row( true ), $row( null ) ), true ), 'In coming soon mode the checks wait for the store to go live' );
+ $this->assertSame( 'Not checked yet', $text( array() ), 'Nothing to check, as Store access while AI shopping is off' );
$map = new \ReflectionMethod( ReadinessCheckPage::class, 'badge_data' );
$map->setAccessible( true );
@@ -1515,6 +1571,55 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
$this->assertNotEmpty( $counted, 'Fix first has a product fix that counts the products' );
}
+ /**
+ * @testdox With AI shopping off, Store access with checks to show keeps them and the note, and no Turn on AI shopping button.
+ */
+ public function test_store_access_with_checks_keeps_the_ucp_off_note(): void {
+ update_option( 'woocommerce_feature_ucp_enabled', 'no' );
+ $row = static fn( string $id ): array => array(
+ 'id' => $id,
+ 'ok' => true,
+ 'blocks' => 'listing',
+ 'group' => 'access',
+ 'level' => 'required',
+ 'name' => $id,
+ 'why' => $id . ' why',
+ 'fix' => $id . ' fix',
+ 'fix_url' => '',
+ );
+ update_option(
+ 'woocommerce_agent_readiness_report',
+ array(
+ 'generated_at' => gmdate( 'c' ),
+ 'store_checks' => array( $row( 'no_noindex_directives' ), $row( 'pages_public' ) ),
+ )
+ );
+ $access = array_column( $this->view()['sections'], null, 'id' )['access'];
+ $this->assertSame( 'Some checks only run when AI shopping is on, like whether AI assistants can connect to your store and send shoppers to your checkout.', $access['note'] );
+ $this->assertNull( $access['empty'] );
+ $this->assertCount( 2, $access['folded'], 'The passed checks stay, as in the design' );
+ }
+
+ /**
+ * @testdox A named product keeps its whole saved name, angle brackets and ampersand included, and ignores markup that title filters add.
+ */
+ public function test_output_product_fix_keeps_the_whole_name(): void {
+ kses_remove_filters(); // An administrator can save a name with angle brackets.
+ $product = WC_Helper_Product::create_simple_product();
+ $product->set_name( "Baker's <Dozen> & Co" );
+ $product->save();
+ kses_init_filters();
+ $wrap = static fn( $title ) => '<span class="badge">' . $title . '</span>';
+ add_filter( 'the_title', $wrap );
+ try {
+ wc_get_container()->get( AgentReadiness::class )->refresh_report();
+ $brand = $this->row( "Add a brand to Baker's <Dozen> & Co" );
+ $this->assertSame( 'View product', $brand['link']['text'], 'The row names the product exactly as saved' );
+ } finally {
+ remove_filter( 'the_title', $wrap );
+ }
+ }
+
/**
* @testdox Sales readiness shows what each channel can list and each failing check, naming the channel that can't list it, with a filtered list link, without the alt text check.
*/
@@ -2361,7 +2466,6 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
* A fresh settings page.
*/
private function page(): AgenticCommerceSettingsPage {
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'yes' );
delete_option( 'woocommerce_feature_ucp_enabled' );
$this->sut->handle_init();
$pages = $this->sut->handle_woocommerce_get_settings_pages( array() );
diff --git a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ProductsListTest.php b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ProductsListTest.php
index 80900ba6ce7..818d8141ff1 100644
--- a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ProductsListTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ProductsListTest.php
@@ -3,7 +3,6 @@ declare( strict_types = 1 );
namespace Automattic\WooCommerce\Tests\Internal\AgentReadiness;
-use Automattic\WooCommerce\Internal\AgentReadiness\AgenticCommerceSettings;
use Automattic\WooCommerce\Internal\AgentReadiness\AgentReadiness;
use Automattic\WooCommerce\Internal\AgentReadiness\ProductFailures;
use Automattic\WooCommerce\Internal\AgentReadiness\ProductsList;
@@ -36,7 +35,6 @@ class ProductsListTest extends WC_Unit_Test_Case {
public function setUp(): void {
parent::setUp();
StoreOutputChecksTest::block_requests();
- update_option( 'woocommerce_feature_' . AgenticCommerceSettings::FEATURE_ID . '_enabled', 'yes' );
$this->readiness = wc_get_container()->get( AgentReadiness::class );
$this->sut = wc_get_container()->get( ProductsList::class );
}
@@ -47,7 +45,6 @@ class ProductsListTest extends WC_Unit_Test_Case {
public function tearDown(): void {
remove_all_filters( 'pre_http_request' );
delete_option( AgentReadiness::REPORT_OPTION );
- delete_option( 'woocommerce_feature_' . AgenticCommerceSettings::FEATURE_ID . '_enabled' );
unset( $_GET[ ProductsList::FILTER_PARAM ] );
parent::tearDown();
}
@@ -345,10 +342,6 @@ class ProductsListTest extends WC_Unit_Test_Case {
$this->assertStringContainsString( 'Show all products</a>', $html );
$this->assertStringContainsString( 'href="' . esc_url( admin_url( 'edit.php?post_type=product' ) ) . '"', $html, 'The link drops the filter' );
- update_option( 'woocommerce_feature_' . AgenticCommerceSettings::FEATURE_ID . '_enabled', 'no' );
- $this->assertSame( '', $notice(), 'No notice with the feature off' );
- update_option( 'woocommerce_feature_' . AgenticCommerceSettings::FEATURE_ID . '_enabled', 'yes' );
-
$GLOBALS['current_screen'] = \WP_Screen::get( 'edit-post' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
$this->assertSame( '', $notice(), 'Only on the Products list' );
} finally {
@@ -385,13 +378,6 @@ class ProductsListTest extends WC_Unit_Test_Case {
$other->set( 'post_type', 'product' );
$this->sut->apply_filter( $other );
$this->assertSame( '', $other->get( 'meta_query' ) );
-
- update_option( 'woocommerce_feature_' . AgenticCommerceSettings::FEATURE_ID . '_enabled', 'no' );
- $off = new \WP_Query();
- $off->set( 'post_type', 'product' );
- $wp_the_query = $off; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
- $this->sut->apply_filter( $off );
- $this->assertSame( '', $off->get( 'meta_query' ), 'The filter stays off with the feature flag' );
} finally {
// A failed assertion must not leave the next test on an admin products screen.
list( $pagenow, $wp_the_query ) = $previous; // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
diff --git a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessAbilitiesTest.php b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessAbilitiesTest.php
index 7235330f8d7..1f350830257 100644
--- a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessAbilitiesTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessAbilitiesTest.php
@@ -48,7 +48,6 @@ class ReadinessAbilitiesTest extends WC_Unit_Test_Case {
do_action( 'wp_abilities_api_categories_init' );
remove_action( 'wp_abilities_api_categories_init', $category );
}
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'yes' );
wp_set_current_user( self::factory()->user->create( array( 'role' => 'administrator' ) ) );
$this->register();
}
@@ -93,9 +92,9 @@ class ReadinessAbilitiesTest extends WC_Unit_Test_Case {
}
/**
- * @testdox AbilitiesLoader registers the abilities with the Ability class, only while the feature is enabled.
+ * @testdox AbilitiesLoader registers the abilities with the Ability class.
*/
- public function test_registered_only_with_feature(): void {
+ public function test_registered_with_ability_class(): void {
$this->assertTrue( wp_has_ability( ReportAbility::NAME ) );
$this->assertInstanceOf( Ability::class, wp_get_ability( ReportAbility::NAME ) );
$this->assertInstanceOf( Ability::class, wp_get_ability( RunCheckAbility::NAME ) );
@@ -103,11 +102,6 @@ class ReadinessAbilitiesTest extends WC_Unit_Test_Case {
$this->assertTrue( $meta['mcp']['public'] );
$this->assertTrue( $meta['annotations']['readonly'] );
$this->assertFalse( wp_get_ability( RunCheckAbility::NAME )->get_meta()['annotations']['idempotent'] );
-
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'no' );
- $this->register();
- $this->assertFalse( wp_has_ability( ReportAbility::NAME ) );
- $this->assertFalse( wp_has_ability( RunCheckAbility::NAME ) );
}
/**
@@ -125,12 +119,14 @@ class ReadinessAbilitiesTest extends WC_Unit_Test_Case {
}
/**
- * @testdox Before the first scan the report is null; after one it matches the output schema, with store checks read now.
+ * @testdox Before the first scan the report is left out; after one it matches the output schema, with store checks read now and no null field.
*/
public function test_report_matches_output_schema(): void {
delete_option( AgentReadiness::REPORT_OPTION );
$ability = wp_get_ability( ReportAbility::NAME );
- $this->assertNull( $ability->execute()['report'] );
+ $before = $ability->execute();
+ $this->assertArrayNotHasKey( 'report', $before, 'Core ability output is never null: an unavailable field is left out' );
+ $this->assertTrue( rest_validate_value_from_schema( $before, $ability->get_output_schema() ) );
WC_Helper_Product::create_simple_product();
wc_get_container()->get( AgentReadiness::class )->refresh_report();
@@ -139,9 +135,11 @@ class ReadinessAbilitiesTest extends WC_Unit_Test_Case {
$output = $ability->execute();
$this->assertTrue( rest_validate_value_from_schema( $output, $ability->get_output_schema() ) );
- $store_checks = array_column( $output['report']['store_checks'], 'ok', 'id' );
- $this->assertFalse( $store_checks['guest_checkout'], 'A setting changed after the scan shows its current state' );
+ $store_checks = array_column( $output['report']['store_checks'], null, 'id' );
+ $this->assertFalse( $store_checks['guest_checkout']['ok'], 'A setting changed after the scan shows its current state' );
$this->assertArrayHasKey( 'sitemap_lists_products', $store_checks, 'Store output checks come from the stored report' );
+ $this->assertArrayNotHasKey( 'ok', $store_checks['sitemap_lists_products'], 'The store can\'t load its own pages in tests, so the check couldn\'t run and ok is left out' );
+ $this->assertFalse( strpos( (string) wp_json_encode( $output ), ':null' ), 'No field anywhere is null' );
$this->assertContains( 'missing_brand', array_column( $output['report']['checks'], 'id' ) );
$this->assertFalse( $output['scan_pending'] );
$this->assertFalse( $output['scan_stalled'] );
@@ -205,7 +203,7 @@ class ReadinessAbilitiesTest extends WC_Unit_Test_Case {
$this->assertTrue( rest_validate_value_from_schema( $output, $ability->get_output_schema() ) );
$this->assertTrue( $output['scan_pending'] );
$this->assertFalse( $output['scan_stalled'] );
- $this->assertNull( $output['report_generated_at'] );
+ $this->assertArrayNotHasKey( 'report_generated_at', $output, 'Left out before the first check' );
$this->assertNull( get_option( AgentReadiness::REPORT_OPTION, null ), 'Nothing ran in the request' );
}
diff --git a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessCheckPageTest.php b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessCheckPageTest.php
index 4befd7bf3b2..371348d4dc8 100644
--- a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessCheckPageTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessCheckPageTest.php
@@ -29,7 +29,6 @@ class ReadinessCheckPageTest extends WC_Unit_Test_Case {
public function setUp(): void {
parent::setUp();
StoreOutputChecksTest::block_requests();
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'yes' );
delete_option( AgentReadiness::REPORT_OPTION );
as_unschedule_all_actions( ScheduledScan::RUN_NOW_HOOK );
$this->sut = wc_get_container()->get( ReadinessCheckPage::class );
@@ -40,7 +39,6 @@ class ReadinessCheckPageTest extends WC_Unit_Test_Case {
*/
public function tearDown(): void {
as_unschedule_all_actions( ScheduledScan::RUN_NOW_HOOK );
- delete_option( 'woocommerce_feature_agent_readiness_enabled' );
parent::tearDown();
}
diff --git a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessRestControllerTest.php b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessRestControllerTest.php
index 4c543bb5eaa..cc7a459b06c 100644
--- a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessRestControllerTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessRestControllerTest.php
@@ -17,19 +17,17 @@ use WP_REST_Request;
class ReadinessRestControllerTest extends WC_REST_Unit_Test_Case {
/**
- * Tests fire rest_api_init with the feature both on and off.
+ * Each test gets a fresh REST server.
*
* @var bool
*/
protected static $reuse_rest_server = false;
/**
- * Enable the feature after parent::setUp(), so the filter stays out of the hook
- * snapshot WordPress takes in the first test. Routes register on first dispatch.
+ * Keep the report tests offline, with no stored report or queued scan. Routes register on first dispatch.
*/
public function setUp(): void {
parent::setUp();
- add_filter( 'pre_option_woocommerce_feature_agent_readiness_enabled', array( __CLASS__, 'enabled' ) );
// Report tests stay offline: store output checks would load the test site's pages.
StoreOutputChecksTest::block_requests();
delete_option( AgentReadiness::REPORT_OPTION );
@@ -46,13 +44,6 @@ class ReadinessRestControllerTest extends WC_REST_Unit_Test_Case {
parent::tearDown();
}
- /**
- * The feature option's value while these tests run.
- */
- public static function enabled(): string {
- return 'yes';
- }
-
/**
* @testdox GET returns a null report before the first scan, then the stored report.
*/
@@ -145,20 +136,6 @@ class ReadinessRestControllerTest extends WC_REST_Unit_Test_Case {
$this->assertFalse( as_has_scheduled_action( ScheduledScan::RUN_NOW_HOOK ) );
}
- /**
- * @testdox With the feature disabled the routes are not registered.
- */
- public function test_routes_absent_when_feature_disabled(): void {
- remove_filter( 'pre_option_woocommerce_feature_agent_readiness_enabled', array( __CLASS__, 'enabled' ) );
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'no' );
- global $wp_rest_server;
- $wp_rest_server = new \WP_REST_Server();
- do_action( 'rest_api_init', $wp_rest_server );
-
- $this->assertSame( 404, $wp_rest_server->dispatch( new WP_REST_Request( 'GET', '/wc/v3/agent-readiness' ) )->get_status() );
- $this->assertSame( 404, $wp_rest_server->dispatch( new WP_REST_Request( 'GET', '/wc/v3/agent-readiness/support-report' ) )->get_status() );
- }
-
/**
* @testdox The support report before the first check has the header and says "Not checked yet", without queueing a check.
*/
@@ -335,36 +312,47 @@ class ReadinessRestControllerTest extends WC_REST_Unit_Test_Case {
* @testdox When no store check could run, the support report says why once, as the page does.
*/
public function test_support_report_says_why_no_check_ran(): void {
+ $unchecked = array(
+ array(
+ 'id' => 'llms_txt_present',
+ 'ok' => null,
+ 'blocks' => 'discovery',
+ 'name' => 'llms.txt',
+ 'why' => '',
+ 'conflict' => false,
+ ),
+ array(
+ 'id' => 'product_shipping_schema',
+ 'ok' => null,
+ 'pending' => true,
+ 'blocks' => 'discovery',
+ 'name' => 'Shipping details',
+ 'why' => '',
+ 'conflict' => false,
+ ),
+ array(
+ 'id' => 'open_graph_tags',
+ 'ok' => null,
+ 'blocks' => 'discovery',
+ 'name' => 'Open Graph tags',
+ 'why' => '',
+ 'conflict' => false,
+ ),
+ );
update_option(
AgentReadiness::REPORT_OPTION,
array(
'generated_at' => '2026-11-18T10:42:00+00:00',
- 'store_checks' => array(
- array(
- 'id' => 'llms_txt_present',
- 'ok' => null,
- 'blocks' => 'discovery',
- 'name' => 'llms.txt',
- 'why' => '',
- 'conflict' => false,
- ),
- array(
- 'id' => 'product_shipping_schema',
- 'ok' => null,
- 'pending' => true,
- 'blocks' => 'discovery',
- 'name' => 'Shipping details',
- 'why' => '',
- 'conflict' => false,
- ),
+ 'store_checks' => array_merge(
array(
- 'id' => 'open_graph_tags',
- 'ok' => null,
- 'blocks' => 'discovery',
- 'name' => 'Open Graph tags',
- 'why' => '',
- 'conflict' => false,
+ array(
+ 'id' => 'launched',
+ 'ok' => true,
+ 'name' => 'Store is launched',
+ 'fix_url' => '',
+ ),
),
+ $unchecked
),
),
false
@@ -374,6 +362,55 @@ class ReadinessRestControllerTest extends WC_REST_Unit_Test_Case {
$this->assertStringContainsString( "### Store checks ###\n\nYour pages couldn’t be checked. Your hosting setup blocked the check from opening them.", $text );
$this->assertSame( 1, substr_count( $text, 'Your pages couldn’t be checked' ) );
+
+ update_option(
+ AgentReadiness::REPORT_OPTION,
+ array(
+ 'generated_at' => '2026-11-18T10:42:00+00:00',
+ 'store_checks' => array_merge(
+ array(
+ array(
+ 'id' => 'launched',
+ 'ok' => false,
+ 'name' => 'Store is launched',
+ 'fix_url' => '',
+ ),
+ ),
+ $unchecked
+ ),
+ ),
+ false
+ );
+ $text = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v3/agent-readiness/support-report' ) )->get_data()['text'];
+ $this->assertStringContainsString( "### Store checks ###\n\nYour store wasn’t live at the last check. These checks run at the next daily check, or you can run the check again now.", $text );
+ $this->assertStringNotContainsString( 'Your hosting setup blocked', $text );
+ $this->assertStringContainsString( 'Open Graph tags (open_graph_tags): Not checked yet. Your store wasn’t live at the last check.', $text, 'Each check says so too, as on the page' );
+ $this->assertStringContainsString( 'Shipping details (product_shipping_schema): Not available yet', $text, 'A check a coming update builds is still not available' );
+ }
+
+ /**
+ * @testdox In the support report, a product page check with no product to open says Not checked yet and why; one that tried and couldn't says Couldn't check.
+ */
+ public function test_support_report_product_page_check_without_a_product(): void {
+ $check = static fn( string $id, ?bool $ok, array $extra = array() ): array => $extra + array(
+ 'id' => $id,
+ 'ok' => $ok,
+ 'blocks' => 'discovery',
+ 'name' => $id,
+ 'why' => '',
+ 'fix_url' => '',
+ );
+ update_option(
+ AgentReadiness::REPORT_OPTION,
+ array(
+ 'generated_at' => '2026-11-18T10:42:00+00:00',
+ 'store_checks' => array( $check( 'launched', true ), $check( 'canonical_url', null, array( 'no_product' => true ) ), $check( 'sitemap_lists_products', null ), $check( 'robots_txt', true ) ),
+ ),
+ false
+ );
+ $text = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v3/agent-readiness/support-report' ) )->get_data()['text'];
+ $this->assertStringContainsString( 'canonical_url (canonical_url): Not checked yet. This check needs a product page.', $text );
+ $this->assertStringContainsString( 'sitemap_lists_products (sitemap_lists_products): Couldn’t check', $text );
}
/**
diff --git a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ScheduledScanTest.php b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ScheduledScanTest.php
index 7fa88d4ac5c..7739b13a649 100644
--- a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ScheduledScanTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ScheduledScanTest.php
@@ -31,7 +31,6 @@ class ScheduledScanTest extends WC_Unit_Test_Case {
parent::setUp();
// Report tests stay offline: store output checks would load the test site's pages.
StoreOutputChecksTest::block_requests();
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'yes' );
add_filter( 'woocommerce_agent_readiness_rules_url', '__return_empty_string' );
delete_option( AgentReadiness::REPORT_OPTION );
as_unschedule_all_actions( ScheduledScan::RUN_NOW_HOOK );
@@ -48,7 +47,6 @@ class ScheduledScanTest extends WC_Unit_Test_Case {
as_unschedule_all_actions( ScheduledScan::RUN_NOW_HOOK );
as_unschedule_all_actions( ScheduledScan::DAILY_HOOK );
as_unschedule_all_actions( ScheduledScan::NEXT_HOOK );
- delete_option( 'woocommerce_feature_agent_readiness_enabled' );
parent::tearDown();
}
@@ -288,18 +286,6 @@ class ScheduledScanTest extends WC_Unit_Test_Case {
$this->assertCount( 1, $this->pending( ScheduledScan::DAILY_HOOK ) );
}
- /**
- * @testdox With the feature disabled a run stores nothing and schedules nothing, ending the daily chain.
- */
- public function test_run_with_feature_disabled(): void {
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'no' );
-
- $this->sut->run();
-
- $this->assertNull( wc_get_container()->get( AgentReadiness::class )->get_cached_report() );
- $this->assertFalse( as_has_scheduled_action( ScheduledScan::DAILY_HOOK ) );
- }
-
/**
* Run the scan's batch actions as Action Scheduler would, until the scan stores its report.
*
@@ -831,23 +817,6 @@ class ScheduledScanTest extends WC_Unit_Test_Case {
clean_post_cache( $product_id );
}
- /**
- * @testdox Turning the feature off during a scan stops it at the next batch, storing nothing.
- */
- public function test_feature_off_stops_the_scan(): void {
- $this->create_products( ProductScan::BATCH_SIZE + 1 );
- $this->sut->run();
- $chain = get_option( AgentReadiness::SCAN_OPTION )['id'];
- $this->sut->run_batch( $chain );
-
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'no' );
- $this->sut->run_batch( $chain );
-
- $this->assertFalse( get_option( AgentReadiness::SCAN_OPTION ) );
- $this->assertFalse( as_has_scheduled_action( ScheduledScan::NEXT_HOOK ) );
- $this->assertNull( wc_get_container()->get( AgentReadiness::class )->get_cached_report() );
- }
-
/**
* Date every finished, failed or running action an hour back, so only what the
* test does next counts as recent queue activity.
diff --git a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/StoreOutputChecksTest.php b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/StoreOutputChecksTest.php
index 00ed88eaa71..bf7b557f66b 100644
--- a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/StoreOutputChecksTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/StoreOutputChecksTest.php
@@ -90,6 +90,31 @@ class StoreOutputChecksTest extends WC_Unit_Test_Case {
return array_column( $this->sut->all(), 'ok', 'id' );
}
+ /**
+ * @testdox A product page check, page HTML or JSON-LD, with no product to open is marked no_product; one whose product page didn't load, or a home page check, is not.
+ */
+ public function test_product_page_check_without_a_product_is_no_product(): void {
+ $this->serve( array( '/' => array( 200, '<html><head><meta name="viewport" content="width=device-width"></head><body></body></html>' ) ) );
+ $checks = array_column( $this->sut->all(), null, 'id' );
+ $this->assertNull( $checks['canonical_url']['ok'] );
+ $this->assertTrue( $checks['canonical_url']['no_product'], 'No product, so the check waits for one' );
+ $this->assertNull( $checks['product_jsonld_present']['ok'] );
+ $this->assertTrue( $checks['product_jsonld_present']['no_product'], 'A JSON-LD check waits for a product too' );
+ $this->assertNull( $checks['product_review_markup']['ok'] );
+ $this->assertTrue( $checks['product_review_markup']['no_product'], 'So does the review markup check' );
+ $this->assertFalse( $checks['viewport_meta']['no_product'], 'A home page check does not need a product' );
+
+ $product = WC_Helper_Product::create_simple_product();
+ $this->serve( array( self::path_of( $product ) => null ) );
+ $checks = array_column( $this->sut->all(), null, 'id' );
+ $this->assertNull( $checks['canonical_url']['ok'] );
+ $this->assertFalse( $checks['canonical_url']['no_product'], 'The product page timed out: that is couldn\'t check' );
+ $this->assertNull( $checks['product_jsonld_present']['ok'] );
+ $this->assertFalse( $checks['product_jsonld_present']['no_product'], 'A JSON-LD check on a page that timed out is couldn\'t check' );
+ $this->assertNull( $checks['product_review_markup']['ok'] );
+ $this->assertFalse( $checks['product_review_markup']['no_product'] );
+ }
+
/**
* @testdox When the store cannot load its own pages, the sitemap check is couldn't check.
*/
diff --git a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/TelemetryTest.php b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/TelemetryTest.php
index f1bd3621b3c..94325681774 100644
--- a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/TelemetryTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/TelemetryTest.php
@@ -25,19 +25,10 @@ class TelemetryTest extends WC_Unit_Test_Case {
*/
public function setUp(): void {
parent::setUp();
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'yes' );
delete_option( AgentReadiness::REPORT_OPTION );
$this->sut = wc_get_container()->get( Telemetry::class );
}
- /**
- * Tear down.
- */
- public function tearDown(): void {
- delete_option( 'woocommerce_feature_agent_readiness_enabled' );
- parent::tearDown();
- }
-
/**
* Store a report as the scan would.
*/
@@ -107,22 +98,6 @@ class TelemetryTest extends WC_Unit_Test_Case {
$this->assertSame( 'yes', $data['agent_readiness']['feature_enabled'] );
}
- /**
- * @testdox With the feature off, the snapshot says so and reads nothing else.
- */
- public function test_feature_off(): void {
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'no' );
- $this->store_report();
-
- $snapshot = $this->sut->snapshot();
-
- $this->assertSame( 'no', $snapshot['feature_enabled'] );
- $this->assertSame( '', $snapshot['last_scan'] );
- $this->assertSame( 'no', $snapshot['truncated'] );
- $this->assertSame( array(), $snapshot['store_checks'] );
- $this->assertSame( array(), $snapshot['product_checks'] );
- }
-
/**
* @testdox Before the first scan, the snapshot has the setup steps but no scan date or product checks.
*/
@@ -162,7 +137,7 @@ class TelemetryTest extends WC_Unit_Test_Case {
}
/**
- * @testdox The snapshot sends the catalog search counts, and none with the feature off.
+ * @testdox The snapshot sends the catalog search counts.
*/
public function test_catalog_search_counts(): void {
$counts = array(
@@ -179,9 +154,6 @@ class TelemetryTest extends WC_Unit_Test_Case {
update_option( StoreOutputChecks::SEARCH_COUNTS_OPTION, $counts );
$this->assertSame( $counts, $this->sut->snapshot()['ucp_search'] );
-
- update_option( 'woocommerce_feature_agent_readiness_enabled', 'no' );
- $this->assertArrayNotHasKey( 'ucp_search', $this->sut->snapshot() );
}
/**