Commit 047f1a0a3d9 for woocommerce
commit 047f1a0a3d913fdc623e9387fcab94bfaa364a27
Author: AnnaMag <AnnaMag@users.noreply.github.com>
Date: Mon Nov 23 16:43:04 2026 +0100
Agent readiness: last edits for 11.4 (content review copy, Tracks events) (#71313)
* Agent readiness: track the AI shopping page, the connection card and the other untracked actions
The Overview's Connect to WordPress.com card records once per visit whether
the store is connected and how a connection attempt ended (connected, error
or none), so clicks can be compared with connections.
link_clicked now also covers the Setup checklist steps (with the step id and
state), Change store visibility, the connection URL's Copy and test link,
the product visibility links, Learn how it works next to the switch, and
Download your results. The README lists every event, including the
AI shopping switch's event from PHP.
* Agent readiness: copy from the 23 Nov content review
- Last checked shows the date, then "at" and the time.
- Change site visibility, the name of the screen it opens, on all three buttons.
- A card none of whose checks ran says Your pages couldn't be checked, since it can
show on any card, not only Product details.
- The badge for checks that couldn't run says Not checked yet, also in coming soon mode.
- A check that couldn't run is titled by what it looks for, not as if it passed, and
says it is checked again each day, or the merchant can select Check again.
* Agent readiness: fix the PHPStan errors in ReadinessCheckPage
They came in with #71287 and fail PHPStan on any PR that touches the file.
The declared groups are now only the ones with items, in the same order,
instead of every group filtered after; the output is the same.
* Agent readiness: say refund and returns policy page in the returns policy fix line
* Agent readiness: daily checks and Analytics import copy from the 23 Nov content review
- Last checked adds "Checks run each day."
- A check that couldn't run: "This check couldn't run. It runs again each day, or you can check again now."
- A card none of whose checks ran: checks run again each day; contact the host if it keeps happening.
- Fix first, while Analytics hasn't imported past orders: the usual line, then that sales
rankings start once it has, with an Import past orders link.
* Agent readiness: say run the check again now, from the content review
* Agent readiness: say Change site visibility in the README and a test name
* Agent readiness: say when the Products list is filtered from AI shopping health
A link such as View 13 products opens Products filtered by a parameter
nothing on the screen showed. A notice above the list now says the list
shows products from AI shopping health, with a Show all products link.
* Agent readiness: set the screen in the notice test without firing screen hooks
diff --git a/plugins/woocommerce/changelog/update-agent-readiness-copy-review-114 b/plugins/woocommerce/changelog/update-agent-readiness-copy-review-114
new file mode 100644
index 00000000000..5080d4966ee
--- /dev/null
+++ b/plugins/woocommerce/changelog/update-agent-readiness-copy-review-114
@@ -0,0 +1,4 @@
+Significance: patch
+Type: tweak
+
+Update AI shopping health wording from the content review, such as Not checked yet and Change site visibility.
diff --git a/plugins/woocommerce/changelog/update-agent-readiness-last-minute-114 b/plugins/woocommerce/changelog/update-agent-readiness-last-minute-114
new file mode 100644
index 00000000000..6ed216fb6cc
--- /dev/null
+++ b/plugins/woocommerce/changelog/update-agent-readiness-last-minute-114
@@ -0,0 +1,4 @@
+Significance: patch
+Type: add
+
+Record AI shopping setup steps, the connection card and other AI tools actions in usage tracking, for stores that allow it.
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/ai-shopping.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/ai-shopping.tsx
index e1ef8faf253..4505f119063 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/ai-shopping.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/ai-shopping.tsx
@@ -25,6 +25,7 @@ import { Button, Link, Stack, Text } from '@wordpress/ui';
* Internal dependencies
*/
import { safeHref } from './safe-href';
+import { trackReadiness } from './tracks';
import './sales-readiness.scss';
import './ai-shopping.scss';
import type { ShoppingView } from './types';
@@ -292,6 +293,12 @@ export default function AiShopping( { view }: { view: ShoppingView } ) {
<Link
href={ safeHref( ucp.learn_more.href ) }
openInNewTab
+ onClick={ () =>
+ trackReadiness( 'link_clicked', {
+ surface: 'shopping',
+ area: 'learn_more',
+ } )
+ }
>
{ ucp.learn_more.text }
</Link>
@@ -319,7 +326,10 @@ export default function AiShopping( { view }: { view: ShoppingView } ) {
isVisible: () => view.coming_soon !== null,
render: () =>
view.coming_soon && (
- <ComingSoonNotice notice={ view.coming_soon } />
+ <ComingSoonNotice
+ notice={ view.coming_soon }
+ surface="shopping"
+ />
),
},
{
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/components/agent-connect.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/components/agent-connect.tsx
index 0de04bb4fed..2609b16f1d3 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/components/agent-connect.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/components/agent-connect.tsx
@@ -3,7 +3,7 @@
*/
import { Card, Text } from '@wordpress/ui';
import { Button, Notice } from '@wordpress/components';
-import { useState } from '@wordpress/element';
+import { useEffect, useState } from '@wordpress/element';
import { __ } from '@wordpress/i18n';
/**
@@ -57,6 +57,16 @@ function postConnect( connect: ConnectView ) {
export const AgentConnect = ( { connect }: { connect: ConnectView } ) => {
const [ notice, setNotice ] = useState( connect.notice );
+ // Once per visit: whether the store is connected, and how a connection attempt ended when the
+ // merchant comes back from WordPress.com.
+ useEffect( () => {
+ trackReadiness( 'agent_connect_viewed', {
+ surface: 'overview',
+ connected: connect.connected,
+ result: connect.notice || 'none',
+ } );
+ // eslint-disable-next-line react-hooks/exhaustive-deps -- Recorded once, for the state the page loaded with.
+ }, [] );
const dismissNotice = () => {
setNotice( '' );
const next = new URL( window.location.href );
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/components/as-link.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/components/as-link.tsx
index 532f111b0d7..0767e87eb62 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/components/as-link.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/components/as-link.tsx
@@ -7,9 +7,10 @@ import { safeHref } from '../safe-href';
* Props that make a @wordpress/ui Button a link, or that disable it when the URL is rejected.
* This version of the package has no ButtonLink.
*
- * @param href Link from the view.
+ * @param href Link from the view.
+ * @param onClick Called when the link is followed, such as to record it.
*/
-export const asLink = ( href: string ) => {
+export const asLink = ( href: string, onClick?: () => void ) => {
const safe = safeHref( href );
if ( ! safe ) {
return { disabled: true };
@@ -17,6 +18,7 @@ export const asLink = ( href: string ) => {
return {
nativeButton: false as const,
role: 'link' as const,
+ onClick,
// The Button renders the text into it.
// eslint-disable-next-line jsx-a11y/anchor-has-content
render: <a href={ safe } />,
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 5f27e6a1d6c..030d659ec7e 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,7 @@ export const CheckRow = ( {
const states: Record< CheckRowData[ 'state' ], string > = {
open: __( 'Issue:', 'woocommerce' ),
required: __( 'Issue:', 'woocommerce' ),
- unknown: __( "Couldn't check:", 'woocommerce' ),
+ unknown: __( 'Not checked yet:', 'woocommerce' ),
pass: __( 'Passed:', 'woocommerce' ),
};
return (
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/components/coming-soon-notice.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/components/coming-soon-notice.tsx
index 67550928cfa..5913baf9210 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/components/coming-soon-notice.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/components/coming-soon-notice.tsx
@@ -8,6 +8,7 @@ import { Notice } from '@wordpress/ui';
/**
* Internal dependencies
*/
+import { trackReadiness, type Surface } from '../tracks';
import type { ViewLink } from '../types';
import { asLink } from './as-link';
@@ -17,8 +18,10 @@ import { asLink } from './as-link';
*/
export const ComingSoonNotice = ( {
notice,
+ surface,
}: {
notice: { text: string; link: ViewLink };
+ surface: Surface;
} ) => (
<Notice.Root intent="warning">
<Notice.Description>{ notice.text }</Notice.Description>
@@ -26,7 +29,12 @@ export const ComingSoonNotice = ( {
<Notice.ActionButton
variant="outline"
className="wc-ai-shopping__notice-action wc-sales-readiness-ui-button"
- { ...asLink( notice.link.href ) }
+ { ...asLink( notice.link.href, () =>
+ trackReadiness( 'link_clicked', {
+ surface,
+ area: 'coming_soon',
+ } )
+ ) }
>
{ notice.link.text }
</Notice.ActionButton>
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/components/connection-url.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/components/connection-url.tsx
index 5450e493878..3e31625448a 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/components/connection-url.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/components/connection-url.tsx
@@ -10,6 +10,7 @@ import { Button, InputControl, Link } from '@wordpress/ui';
* Internal dependencies
*/
import { safeHref } from '../safe-href';
+import { trackReadiness } from '../tracks';
import type { ShoppingView } from '../types';
/**
@@ -25,6 +26,10 @@ export const ConnectionUrl = ( {
useEffect( () => () => clearTimeout( timer.current ), [] );
const copy = async () => {
+ trackReadiness( 'link_clicked', {
+ surface: 'shopping',
+ area: 'connection_url_copy',
+ } );
if ( ! navigator.clipboard ) {
return;
}
@@ -56,7 +61,16 @@ export const ConnectionUrl = ( {
{ copied ? connection.copied : connection.copy }
</Button>
</div>
- <Link href={ safeHref( connection.test.href ) } openInNewTab>
+ <Link
+ href={ safeHref( connection.test.href ) }
+ openInNewTab
+ onClick={ () =>
+ trackReadiness( 'link_clicked', {
+ surface: 'shopping',
+ area: 'connection_url_test',
+ } )
+ }
+ >
{ connection.test.text }
</Link>
</div>
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/components/product-visibility.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/components/product-visibility.tsx
index f7da0d3e0e2..288c274e84b 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/components/product-visibility.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/components/product-visibility.tsx
@@ -11,6 +11,7 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import { safeHref } from '../safe-href';
+import { trackReadiness } from '../tracks';
import type { ShoppingView } from '../types';
/**
@@ -71,7 +72,16 @@ export const ProductVisibility = ( {
{ count.count }
</Text>
<Text variant="body-sm">
- <Link href={ safeHref( count.link.href ) }>
+ <Link
+ href={ safeHref( count.link.href ) }
+ onClick={ () =>
+ trackReadiness( 'link_clicked', {
+ surface: 'shopping',
+ area: 'product_visibility',
+ count_id: count.id,
+ } )
+ }
+ >
{ count.link.text }
</Link>
</Text>
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/components/shopping-checklist.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/components/shopping-checklist.tsx
index 15093664fa1..74ee19db1f1 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/components/shopping-checklist.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/components/shopping-checklist.tsx
@@ -11,6 +11,7 @@ import { __ } from '@wordpress/i18n';
* Internal dependencies
*/
import type { ShoppingView } from '../types';
+import { trackReadiness } from '../tracks';
import { asLink } from './as-link';
import { Row, useSrDescription } from './check-row';
@@ -20,11 +21,14 @@ type Checklist = ShoppingView[ 'checklist' ];
* A step's button, with the policy it is for read as its description.
*
* @param props Props.
+ * @param props.step The step.
* @param props.link The step's link.
*/
const StepButton = ( {
+ step,
link,
}: {
+ step: Checklist[ 'steps' ][ number ];
link: NonNullable< Checklist[ 'steps' ][ number ][ 'link' ] >;
} ) => {
const sr = useSrDescription( link.sr );
@@ -34,7 +38,14 @@ const StepButton = ( {
variant="outline"
size="compact"
className="wc-sales-readiness-ui-button"
- { ...asLink( link.href ) }
+ { ...asLink( link.href, () =>
+ trackReadiness( 'link_clicked', {
+ surface: 'shopping',
+ area: 'setup',
+ check_id: step.id,
+ state: step.state,
+ } )
+ ) }
{ ...sr.props }
>
{ link.text }
@@ -77,7 +88,12 @@ export const ShoppingChecklist = ( {
badge={ step.badge }
srState={ issue }
action={
- step.link && <StepButton link={ step.link } />
+ step.link && (
+ <StepButton
+ step={ step }
+ link={ step.link }
+ />
+ )
}
>
{ step.lines.map( ( line ) => (
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/components/support-download.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/components/support-download.tsx
index 505c334764e..4de254a5e92 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/components/support-download.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/components/support-download.tsx
@@ -7,6 +7,11 @@ import apiFetch from '@wordpress/api-fetch';
import { Link } from '@wordpress/ui';
import { __ } from '@wordpress/i18n';
+/**
+ * Internal dependencies
+ */
+import { trackReadiness } from '../tracks';
+
export const SUPPORT_REPORT_PATH = '/wc/v3/agent-readiness/support-report';
/**
@@ -23,6 +28,10 @@ export const SupportDownload = ( {
const [ busy, setBusy ] = useState( false );
const download = async () => {
+ trackReadiness( 'link_clicked', {
+ surface: 'page',
+ area: 'support_download',
+ } );
setBusy( true );
onError( '' );
try {
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/index.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/index.tsx
index cf532acae7e..387de4e5dfa 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/index.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/index.tsx
@@ -62,7 +62,10 @@ export default function SalesReadiness() {
onDownloadError={ setDownloadError }
/>
{ view.coming_soon && (
- <ComingSoonNotice notice={ view.coming_soon } />
+ <ComingSoonNotice
+ notice={ view.coming_soon }
+ surface="page"
+ />
) }
{ view.fix_first && (
<FixFirstCard fixFirst={ view.fix_first } />
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/test/agent-connect.test.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/test/agent-connect.test.tsx
index 03b1603798e..89c80b06d39 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/test/agent-connect.test.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/test/agent-connect.test.tsx
@@ -105,6 +105,42 @@ describe( 'AgentConnect', () => {
).toBeInTheDocument();
} );
+ it( 'records once whether the store is connected, and how a connection attempt ended', () => {
+ const mocked = trackReadiness as jest.Mock;
+ mocked.mockClear();
+ const { rerender, unmount } = render(
+ <AgentConnect connect={ { ...connect, notice: 'error' } } />
+ );
+ rerender(
+ <AgentConnect connect={ { ...connect, notice: 'error' } } />
+ );
+ expect( mocked ).toHaveBeenCalledTimes( 1 );
+ expect( mocked ).toHaveBeenCalledWith( 'agent_connect_viewed', {
+ surface: 'overview',
+ connected: false,
+ result: 'error',
+ } );
+ unmount();
+
+ mocked.mockClear();
+ render(
+ <AgentConnect
+ connect={ {
+ connected: true,
+ notice: 'connected',
+ url: '',
+ action: '',
+ nonce: '',
+ } }
+ />
+ );
+ expect( mocked ).toHaveBeenCalledWith( 'agent_connect_viewed', {
+ surface: 'overview',
+ connected: true,
+ result: 'connected',
+ } );
+ } );
+
it( 'keeps the button next to the error when connecting failed', () => {
render( <AgentConnect connect={ { ...connect, notice: 'error' } } /> );
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/test/ai-shopping.test.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/test/ai-shopping.test.tsx
index c2315b948a7..5cd2a396c12 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/test/ai-shopping.test.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/test/ai-shopping.test.tsx
@@ -14,10 +14,13 @@ import apiFetch from '@wordpress/api-fetch';
* Internal dependencies
*/
import AiShopping from '../ai-shopping';
+import { trackReadiness } from '../tracks';
import type { ShoppingView } from '../types';
jest.mock( '@wordpress/api-fetch', () => jest.fn() );
jest.mock( '@wordpress/a11y', () => ( { speak: jest.fn() } ) );
+jest.mock( '../tracks', () => ( { trackReadiness: jest.fn() } ) );
+const mockedTrack = trackReadiness as jest.Mock;
const mockCreateSuccessNotice = jest.fn();
jest.mock( '@wordpress/data', () => ( {
...jest.requireActual( '@wordpress/data' ),
@@ -257,14 +260,14 @@ describe( 'AiShopping', () => {
expect( screen.queryByText( 'Required' ) ).toBeNull();
} );
- it( 'says what to do in coming soon mode, with a way to change store visibility', () => {
+ it( 'says what to do in coming soon mode, with a way to change site visibility', () => {
renderPage(
view( {
coming_soon: {
text: 'Your store is in coming soon mode, so AI assistants can’t find your products yet.',
link: {
href: '/wp-admin/admin.php?page=wc-settings&tab=site-visibility',
- text: 'Change store visibility',
+ text: 'Change site visibility',
},
},
} )
@@ -274,7 +277,7 @@ describe( 'AiShopping', () => {
screen.getByText( /coming soon mode/, { selector: 'span' } )
).toBeInTheDocument();
expect(
- screen.getByRole( 'link', { name: 'Change store visibility' } )
+ screen.getByRole( 'link', { name: 'Change site visibility' } )
).toHaveAttribute(
'href',
'/wp-admin/admin.php?page=wc-settings&tab=site-visibility'
@@ -565,6 +568,64 @@ describe( 'AiShopping', () => {
);
} );
+ it( 'records the Setup checklist, product visibility, Learn how it works, coming soon and connection URL clicks', () => {
+ mockedTrack.mockClear();
+ renderPage(
+ view( {
+ coming_soon: {
+ text: 'Your store is in coming soon mode.',
+ link: {
+ href: '/wp-admin/admin.php?page=wc-settings&tab=site-visibility',
+ text: 'Change site visibility',
+ },
+ },
+ } )
+ );
+ const click = ( name: string | RegExp, index = 0 ) =>
+ fireEvent.click( screen.getAllByRole( 'link', { name } )[ index ] );
+
+ click( 'View Site Health' );
+ click( 'View products', 1 );
+ click( /Learn how it works/ );
+ click( 'Change site visibility' );
+ click( /Test the connection in UCP Playground/ );
+ fireEvent.click( screen.getByRole( 'button', { name: 'Copy' } ) );
+
+ const calls = mockedTrack.mock.calls.map( ( [ name, props ] ) => [
+ name,
+ props,
+ ] );
+ expect( calls ).toEqual( [
+ [
+ 'link_clicked',
+ {
+ surface: 'shopping',
+ area: 'setup',
+ check_id: 'https',
+ state: 'required',
+ },
+ ],
+ [
+ 'link_clicked',
+ {
+ surface: 'shopping',
+ area: 'product_visibility',
+ count_id: 'hidden',
+ },
+ ],
+ [ 'link_clicked', { surface: 'shopping', area: 'learn_more' } ],
+ [ 'link_clicked', { surface: 'shopping', area: 'coming_soon' } ],
+ [
+ 'link_clicked',
+ { surface: 'shopping', area: 'connection_url_test' },
+ ],
+ [
+ 'link_clicked',
+ { surface: 'shopping', area: 'connection_url_copy' },
+ ],
+ ] );
+ } );
+
it( 'goes to a policy field from a link, on load and from the Setup checklist on this page', () => {
const scroll = jest.fn();
Element.prototype.scrollIntoView = scroll;
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 934abc58726..408c75f5b7d 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
@@ -213,7 +213,7 @@ describe( 'CheckRow', () => {
} )
);
- expect( screen.getByText( "Couldn't check:" ) ).toBeInTheDocument();
+ expect( screen.getByText( 'Not checked yet:' ) ).toBeInTheDocument();
expect(
screen.getByText( "This couldn't be checked. Try again later." )
).toBeInTheDocument();
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/test/support-download.test.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/test/support-download.test.tsx
index de36a387ec3..3809bb5cc33 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/test/support-download.test.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/test/support-download.test.tsx
@@ -12,9 +12,11 @@ import {
SupportDownload,
} from '../components/support-download';
import { CheckedCard } from '../components/checked-card';
+import { trackReadiness } from '../tracks';
import type { ReadinessView } from '../types';
jest.mock( '@wordpress/api-fetch', () => jest.fn() );
+jest.mock( '../tracks', () => ( { trackReadiness: jest.fn() } ) );
const mockFetch = apiFetch as unknown as jest.Mock;
describe( 'SupportDownload', () => {
@@ -56,6 +58,10 @@ describe( 'SupportDownload', () => {
expect( blob.type ).toBe( 'text/plain;charset=utf-8' );
expect( blob.size ).toBe( 'Site: https://example.org\n'.length );
expect( onError ).toHaveBeenLastCalledWith( '' );
+ expect( trackReadiness ).toHaveBeenCalledWith( 'link_clicked', {
+ surface: 'page',
+ area: 'support_download',
+ } );
} );
it( 'reports an error when the report can’t be loaded, and saves nothing', async () => {
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/test/tracks.test.tsx b/plugins/woocommerce/client/admin/client/sales-readiness/test/tracks.test.tsx
index 6ce3fce1bbe..95ac603ff30 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/test/tracks.test.tsx
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/test/tracks.test.tsx
@@ -481,7 +481,7 @@ describe( 'Sales readiness page', () => {
text: 'Your store is in coming soon mode.',
link: {
href: 'https://example.com/wp-admin/admin.php?page=wc-settings&tab=site-visibility',
- text: 'Change store visibility',
+ text: 'Change site visibility',
},
},
} );
@@ -491,7 +491,7 @@ describe( 'Sales readiness page', () => {
'Your store is in coming soon mode.'
);
expect(
- screen.getByRole( 'link', { name: 'Change store visibility' } )
+ screen.getByRole( 'link', { name: 'Change site visibility' } )
).toHaveAttribute(
'href',
'https://example.com/wp-admin/admin.php?page=wc-settings&tab=site-visibility'
diff --git a/plugins/woocommerce/client/admin/client/sales-readiness/tracks.ts b/plugins/woocommerce/client/admin/client/sales-readiness/tracks.ts
index cc0b980b7a6..aceccfa7378 100644
--- a/plugins/woocommerce/client/admin/client/sales-readiness/tracks.ts
+++ b/plugins/woocommerce/client/admin/client/sales-readiness/tracks.ts
@@ -8,8 +8,8 @@ import { recordEvent } from '@woocommerce/tracks';
*/
import type { ReadinessView } from './types';
-/** Where the event happened: the Sales readiness page or the AI tools Overview. */
-export type Surface = 'page' | 'overview';
+/** Where the event happened: AI shopping health, the AI tools Overview, or AI shopping. */
+export type Surface = 'page' | 'overview' | 'shopping';
type Props = Record< string, string | number | boolean >;
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/AgenticCommerceSettingsPage.php b/plugins/woocommerce/src/Internal/AgentReadiness/AgenticCommerceSettingsPage.php
index 2a06118066f..c308e786e17 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/AgenticCommerceSettingsPage.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/AgenticCommerceSettingsPage.php
@@ -254,7 +254,7 @@ class AgenticCommerceSettingsPage extends \WC_Settings_Page {
'text' => __( 'Your store is in coming soon mode, so AI assistants can’t find your products yet.', 'woocommerce' ),
'link' => array(
'href' => $launched['fix_url'],
- 'text' => __( 'Change store visibility', 'woocommerce' ),
+ 'text' => __( 'Change site visibility', 'woocommerce' ),
),
) : null,
'visibility' => self::visibility( $report ),
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/ProductsList.php b/plugins/woocommerce/src/Internal/AgentReadiness/ProductsList.php
index 778882c0320..1a94801b5fe 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/ProductsList.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/ProductsList.php
@@ -87,6 +87,7 @@ class ProductsList {
add_action( 'woocommerce_before_delete_product_variation', array( $this, 'handle_before_variation_delete' ) );
add_action( 'woocommerce_delete_product_variation', array( $this, 'handle_variation_removed' ) );
add_action( 'pre_get_posts', array( $this, 'apply_filter' ) );
+ add_action( 'admin_notices', array( $this, 'filter_notice' ) );
}
/**
@@ -324,6 +325,26 @@ class ProductsList {
$query->set( 'meta_query', $meta_query ); // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
}
+ /**
+ * Say above the Products list when it shows only the products from an AI shopping health link,
+ * with a way back to all products. Nothing else on the screen shows that filter.
+ *
+ * @internal
+ */
+ 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 ] ) ) {
+ return;
+ }
+ printf(
+ '<div class="notice notice-info"><p>%s <a href="%s">%s</a></p></div>',
+ esc_html__( 'Showing products from AI shopping health.', 'woocommerce' ),
+ esc_url( admin_url( 'edit.php?post_type=product' ) ),
+ esc_html__( 'Show all products', 'woocommerce' )
+ );
+ }
+
/**
* Whether the feature is on.
*/
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/README.md b/plugins/woocommerce/src/Internal/AgentReadiness/README.md
index 1801018a815..91b9585f6ce 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/README.md
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/README.md
@@ -114,7 +114,7 @@ The checks from `no_noindex_directives` down pass on a stock store today. They s
## Failures per product
-`refresh_report()` stores what each product fails in product meta (`ProductFailures`), one row per check and per channel status, plus a `checked` row on every product the checks cover, passing ones included. `ProductsList` updates a product's rows when it is saved, except for a save that changes only stock or nothing, removes them when it is trashed, tests the parent again when a variation is trashed, restored or deleted, and filters the Products list on them for the links from the readiness pages (`?agent_readiness=<value>`); there is no column or dropdown on the list. A covered product without rows was not tested, by the scan's product limit. The stored report's product counts are read from these rows, the total from the `checked` rows, so a product fixed, added or removed since the scan counts now. The example products per check can be out of date; the count links to the filtered Products list. The scan stores the GTINs more than one product shares in the report (`shared_gtins`, not returned by the report readers, up to `ProductScan::SHARED_GTINS_LIMIT`), so checking one product on save or with the run ability doesn't read every published product. Past the limit, nothing is stored and a check of one product reads the catalog. A GTIN shared since the scan, on the saved product or another, is flagged at the next scan. Core refuses an exact duplicate on save, so this is one that differs only by separators or leading zeros, or a direct meta write.
+`refresh_report()` stores what each product fails in product meta (`ProductFailures`), one row per check and per channel status, plus a `checked` row on every product the checks cover, passing ones included. `ProductsList` updates a product's rows when it is saved, except for a save that changes only stock or nothing, removes them when it is trashed, tests the parent again when a variation is trashed, restored or deleted, and filters the Products list on them for the links from the readiness pages (`?agent_readiness=<value>`); there is no column or dropdown on the list. A notice above the list says it shows products from AI shopping health, with a Show all products link (`ProductsList::filter_notice()`). A covered product without rows was not tested, by the scan's product limit. The stored report's product counts are read from these rows, the total from the `checked` rows, so a product fixed, added or removed since the scan counts now. The example products per check can be out of date; the count links to the filtered Products list. The scan stores the GTINs more than one product shares in the report (`shared_gtins`, not returned by the report readers, up to `ProductScan::SHARED_GTINS_LIMIT`), so checking one product on save or with the run ability doesn't read every published product. Past the limit, nothing is stored and a check of one product reads the catalog. A GTIN shared since the scan, on the saved product or another, is flagged at the next scan. Core refuses an exact duplicate on save, so this is one that differs only by separators or leading zeros, or a direct meta write.
## What the store declares to agents
@@ -219,21 +219,23 @@ Sales readiness opens with when the last check ran and Check again ("Check your
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, when nothing failed but a check couldn't run, says Couldn't check (the row says why); before the first check it says Not checked yet. 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. 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%.
Tracks event: `agentic_commerce_ucp_toggled` (`enabled`), sent only when the store allows tracking.
### Tracking
-The React views send Tracks events through `@woocommerce/tracks` (`client/admin/client/sales-readiness/tracks.ts`), so they get the `wcadmin_` prefix and are sent only when the store allows usage tracking. `surface` is `page` (Sales readiness) or `overview` (AI tools). Check ids are the report's ids (`refund_policy`, `image`, `llms_txt`), never translated titles; `ReadinessCheckPage::view()` adds an `id` to every row and Fix first item for this. wc-admin's own `wcadmin_page_view` already counts visits to the page.
+The React views send Tracks events through `@woocommerce/tracks` (`client/admin/client/sales-readiness/tracks.ts`), so they get the `wcadmin_` prefix and are sent only when the store allows usage tracking. `surface` is `page` (AI shopping health), `overview` (AI tools) or `shopping` (AI shopping). Check ids are the report's ids (`refund_policy`, `image`, `llms_txt`), never translated titles; `ReadinessCheckPage::view()` adds an `id` to every row and Fix first item for this. wc-admin's own `wcadmin_page_view` already counts visits to the page.
| Event | When | Properties |
| --- | --- | --- |
| `wcadmin_sales_readiness_viewed` | The view first loads, once per visit | `surface`, `checked`, `pending`, `fix_first_count`, `open_count`, `required_count`, `unknown_count`, `pass_count` (a check shown in two cards counts once) |
| `wcadmin_sales_readiness_run_check_clicked` | Run checks or Check again | `surface`, `first_check` |
-| `wcadmin_sales_readiness_link_clicked` | A fix link, View all checks, or Manage | `surface`, `area` (`fix_first`, `section`, `view_all`, `shopping`); for fixes `check_id`, plus `position` in Fix first or `section` and `state` in a section card |
+| `wcadmin_sales_readiness_link_clicked` | A fix link or another link or button on these pages | `surface`, `area`: `fix_first`, `section`, `view_all`, `shopping` (Manage), `agent_connect` (Connect to WordPress.com), `setup` (a Setup checklist step), `coming_soon` (Change site visibility), `connection_url_copy`, `connection_url_test`, `product_visibility` (with `count_id`), `learn_more` (next to the AI shopping switch) or `support_download`. Fixes and setup steps add `check_id`, plus `position` in Fix first, `section` and `state` in a section card, or `state` in the Setup checklist |
+| `wcadmin_sales_readiness_agent_connect_viewed` | The Connect to WordPress.com card shows on the Overview, once per visit | `surface`, `connected`, `result` (`connected` or `error` when the merchant comes back from a connection attempt, otherwise `none`) |
| `wcadmin_sales_readiness_fold_toggle` | Show N passed checks or Hide passed checks | `surface`, `section` (a section id, or `declared`), `open` |
| `wcadmin_sales_readiness_error` | The view can't load, or a check can't start | `surface`, `action` (`load` or `run`) |
+| `wcadmin_agentic_commerce_ucp_toggled` | The AI shopping switch saves (sent from PHP, `UcpSwitch`) | `enabled` (`yes` or `no`) |
## Usage tracking
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessCheckPage.php b/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessCheckPage.php
index dcf470ddcaa..5d3ce5eb392 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessCheckPage.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessCheckPage.php
@@ -249,11 +249,13 @@ class ReadinessCheckPage implements RegisterHooksInterface {
*
* @template T of array{id:string,level:string}
* @param array<int|string, T> $checks Store conditions, already in setup order.
- * @return array<int, T>
+ * @return list<T>
*/
private static function required_first( array $checks ): array {
$required = array( StoreConditions::class, 'shows_required' );
- return array_merge( array_values( array_filter( $checks, $required ) ), array_values( array_filter( $checks, static fn( array $check ): bool => ! $required( $check ) ) ) );
+ /** @var list<T> $sorted */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort -- PHPStan loses the template type through array_filter.
+ $sorted = array_merge( array_values( array_filter( $checks, $required ) ), array_values( array_filter( $checks, static fn( array $check ): bool => ! $required( $check ) ) ) );
+ return $sorted;
}
/**
@@ -262,7 +264,7 @@ class ReadinessCheckPage implements RegisterHooksInterface {
*
* @template T of array{id:string}
* @param array<int|string, T> $checks Store conditions.
- * @return array<int, T>
+ * @return list<T>
*/
private static function setup_order( array $checks ): array {
$rank = array_flip( self::SETUP_ORDER );
@@ -276,7 +278,9 @@ class ReadinessCheckPage implements RegisterHooksInterface {
}
}
ksort( $ranked );
- return array_merge( array_values( $ranked ), $rest );
+ /** @var list<T> $sorted */ // phpcs:ignore Generic.Commenting.DocComment.MissingShort -- PHPStan loses the template type through array_filter.
+ $sorted = array_merge( array_values( $ranked ), $rest );
+ return $sorted;
}
/**
@@ -556,10 +560,10 @@ class ReadinessCheckPage implements RegisterHooksInterface {
}
if ( wp_date( 'Y-m-d', $time ) === wp_date( 'Y-m-d' ) ) {
/* translators: %s: time of day, such as 10:42 am. */
- return sprintf( __( 'Last checked today at %s', 'woocommerce' ), wp_date( (string) get_option( 'time_format' ), $time ) );
+ return sprintf( __( 'Last checked today at %s. Checks run each day.', 'woocommerce' ), wp_date( (string) get_option( 'time_format' ), $time ) );
}
- /* translators: %s: date and time, such as November 3, 2026 10:42 am. */
- return sprintf( __( 'Last checked %s', 'woocommerce' ), wp_date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $time ) );
+ /* translators: 1: date, such as November 3, 2026. 2: time of day, such as 10:42 am. */
+ return sprintf( __( 'Last checked %1$s at %2$s. Checks run each day.', 'woocommerce' ), wp_date( (string) get_option( 'date_format' ), $time ), wp_date( (string) get_option( 'time_format' ), $time ) );
}
@@ -726,7 +730,7 @@ class ReadinessCheckPage implements RegisterHooksInterface {
'link' => array(
'href' => (string) $launched['fix_url'],
// The same button as the AI shopping notice, from the content review.
- 'text' => __( 'Change store visibility', 'woocommerce' ),
+ 'text' => __( 'Change site visibility', 'woocommerce' ),
),
);
}
@@ -760,7 +764,7 @@ class ReadinessCheckPage implements RegisterHooksInterface {
*/
public static function cant_check_copy( bool $launched ): array {
return $launched
- ? array( __( 'We couldn’t check your pages', 'woocommerce' ), __( 'Your hosting setup blocked the check from opening them. Try again later, or contact your hosting provider.', 'woocommerce' ) )
+ ? 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' ) );
}
@@ -934,7 +938,7 @@ class ReadinessCheckPage implements RegisterHooksInterface {
if ( is_array( $report['sales'] ?? null ) && false === ( $report['sales']['imported'] ?? true ) ) {
return array(
'href' => admin_url( 'admin.php?page=wc-admin&path=/analytics/settings' ),
- 'text' => __( 'Import your past orders in Analytics settings', 'woocommerce' ),
+ 'text' => __( 'Import past orders', 'woocommerce' ),
);
}
return null;
@@ -957,7 +961,7 @@ class ReadinessCheckPage implements RegisterHooksInterface {
return __( 'Start with the fixes that affect the most products.', 'woocommerce' );
}
if ( false === ( $sales['imported'] ?? true ) ) {
- return __( 'Analytics hasn\'t imported all your past orders yet, so issues are ranked by how many products and AI apps they affect.', 'woocommerce' );
+ return __( 'Start with the fixes that affect the most products. Sales rankings start once Analytics has imported your past orders.', 'woocommerce' );
}
$orders = (int) ( $sales['orders'] ?? 0 );
$days = (int) ( $sales['days'] ?? 0 );
@@ -1108,7 +1112,7 @@ class ReadinessCheckPage implements RegisterHooksInterface {
'code' => __( 'In your page code', 'woocommerce' ),
'unknown' => __( 'Not checked yet', 'woocommerce' ),
);
- $groups = array_fill_keys( array_keys( $titles ), array() );
+ $groups = array();
foreach ( $items as $item ) {
$found = $item['found'] ?? null;
$group = null === $found ? 'unknown' : DeclaredToAgents::group( (string) ( $item['id'] ?? '' ) );
@@ -1118,7 +1122,7 @@ class ReadinessCheckPage implements RegisterHooksInterface {
);
}
$found = count( array_filter( $items, static fn( array $item ): bool => true === ( $item['found'] ?? null ) ) );
- $checked = count( $items ) - count( $groups['unknown'] );
+ $checked = count( $items ) - count( $groups['unknown'] ?? array() );
// The count covers the items the scan could read, so a store in coming soon mode isn't told it shares none.
$text = 0 === $checked
? __( 'These are other files and code that some AI assistants use to learn about your store. None are required, so there’s nothing to fix.', 'woocommerce' )
@@ -1145,30 +1149,25 @@ class ReadinessCheckPage implements RegisterHooksInterface {
'title' => __( 'Extra details for AI assistants', 'woocommerce' ),
'badge' => self::badge_data( array( 'off', __( 'Optional', 'woocommerce' ) ) ),
'text' => $text,
- 'groups' => array_values(
- array_filter(
- array_map(
- static fn( string $key ): array => array(
- 'title' => $titles[ $key ],
- 'items' => $groups[ $key ],
- ),
- array_keys( $titles )
- ),
- static fn( array $group ): bool => array() !== $group['items']
- )
+ // In the order of $titles, leaving out the groups with no items.
+ 'groups' => array_map(
+ static fn( string $key ): array => array(
+ 'title' => $titles[ $key ],
+ 'items' => $groups[ $key ],
+ ),
+ array_keys( array_intersect_key( $titles, $groups ) )
),
);
}
/**
- * The badge on a question: how many issues, that everything passed, or, when nothing failed but
- * a check couldn't run, Couldn't check (its row says why). Before the first check, Not checked yet.
+ * 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).
*
- * @param array<int, array{ok:bool|null}> $checks The question's checks.
- * @param bool $checked Whether a check has run.
+ * @param array<int, array{ok:bool|null}> $checks The question's checks.
* @return array{0:string,1:string} Badge class and text.
*/
- private static function group_badge( array $checks, bool $checked = true ): array {
+ private static function group_badge( array $checks ): array {
$issues = count( array_filter( $checks, static fn( array $check ): bool => false === $check['ok'] ) );
if ( $issues > 0 ) {
/* translators: %d: number of issues. */
@@ -1178,16 +1177,16 @@ class ReadinessCheckPage implements RegisterHooksInterface {
if ( $passed > 0 && count( $checks ) === $passed ) {
return array( 'info', __( 'All passed', 'woocommerce' ) );
}
- return $checked ? self::cant_check_badge() : array( 'off', __( 'Not checked yet', 'woocommerce' ) );
+ return self::cant_check_badge();
}
/**
- * The Couldn't check badge, on a question where nothing failed but a check couldn't run.
+ * The Not checked yet badge, on a question where nothing failed but a check couldn't run, or before the first check.
*
* @return array{0:string,1:string} Badge class and text.
*/
private static function cant_check_badge(): array {
- return array( 'off', __( 'Couldn’t check', 'woocommerce' ) );
+ return array( 'off', __( 'Not checked yet', 'woocommerce' ) );
}
/**
@@ -1209,7 +1208,9 @@ class ReadinessCheckPage implements RegisterHooksInterface {
'why' => $step[1],
) : ReadinessCopy::store_check( $check['id'] );
if ( null === $check['ok'] ) {
- $rows[] = self::row( $check['id'], 'unknown', $copy['title'] ?? $check['name'], $launched ? __( 'This couldn\'t be checked. The next check tries again.', 'woocommerce' ) : __( 'Launch your store to run this check.', 'woocommerce' ) );
+ // 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' ) );
continue;
}
if ( $check['ok'] ) {
@@ -1225,7 +1226,7 @@ class ReadinessCheckPage implements RegisterHooksInterface {
$seen_at = '' !== $seen_url
? array(
'href' => $seen_url,
- 'text' => (string) $check['seen_at'],
+ 'text' => (string) ( $check['seen_at'] ?? '' ),
)
: null;
$rows[] = self::row( $check['id'], $required ? 'required' : 'open', $failing['title'], $failing['text'], $failing['fix'], self::fix_link( $failing['url'], $failing['link'] ?? '', $failing['sr'] ?? '' ), $required ? self::required_badge() : null, $seen_at, $failing['tool'] ?? null );
@@ -1318,7 +1319,7 @@ class ReadinessCheckPage implements RegisterHooksInterface {
$sections[] = array(
'id' => $id,
'title' => $group[0],
- 'badge' => self::badge_data( $cant && array() === $rows ? self::cant_check_badge() : self::group_badge( $checks, array() !== $report ) ),
+ '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 ),
'channels' => array(),
'rows' => $cant ? array_merge( $rows, array( self::cant_check_row( $launched ) ) ) : $rows,
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessCopy.php b/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessCopy.php
index 3b1b4c925eb..ab1fa13f49d 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessCopy.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessCopy.php
@@ -560,7 +560,7 @@ final class ReadinessCopy {
__( 'AI assistants use it to tell shoppers whether they can return an item before they buy.', 'woocommerce' ),
__( 'Your product page code doesn’t include your returns policy, so AI assistants can’t tell shoppers whether they can return an item.', 'woocommerce' ),
// Shown only once a published refund and returns page is chosen, so the fix can't be to choose one.
- __( 'WooCommerce adds it from your refund and returns page. Check the schema settings in your SEO plugin or theme.', 'woocommerce' ),
+ __( 'WooCommerce adds it from your refund and returns policy page. Check the schema settings in your SEO plugin or theme.', 'woocommerce' ),
),
'product_shipping_schema' => array(
__( 'Product details include shipping', 'woocommerce' ),
diff --git a/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessMarkup.php b/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessMarkup.php
index fa0b9c65958..78dbfae74d9 100644
--- a/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessMarkup.php
+++ b/plugins/woocommerce/src/Internal/AgentReadiness/ReadinessMarkup.php
@@ -105,7 +105,7 @@ trait ReadinessMarkup {
}
$labels = array(
'https' => __( 'View Site Health', 'woocommerce' ),
- 'launched' => __( 'Change store visibility', 'woocommerce' ),
+ 'launched' => __( 'Change site visibility', 'woocommerce' ),
'guest_checkout' => __( 'View account settings', 'woocommerce' ),
'payment_method' => __( 'View payment settings', 'woocommerce' ),
'order_emails' => __( 'View email settings', 'woocommerce' ),
diff --git a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/AgenticCommerceSettingsTest.php b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/AgenticCommerceSettingsTest.php
index 8f3e1724b91..b14bbb2c492 100644
--- a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/AgenticCommerceSettingsTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/AgenticCommerceSettingsTest.php
@@ -526,10 +526,10 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
$shopping = $this->shopping();
$this->assertSame( 'Your store is in coming soon mode, so AI assistants can’t find your products yet.', $shopping['coming_soon']['text'] );
- $this->assertSame( 'Change store visibility', $shopping['coming_soon']['link']['text'], 'As in the content review' );
+ $this->assertSame( 'Change site visibility', $shopping['coming_soon']['link']['text'], 'As in the content review' );
$this->assertStringContainsString( 'site-visibility', $shopping['coming_soon']['link']['href'] );
$this->assertTrue( $shopping['ucp']['blocked'], 'A store that is not live can\'t turn AI shopping on' );
- $this->assertSame( 'Change store visibility', $this->step( $shopping, 'launched' )['link']['text'] );
+ $this->assertSame( 'Change site visibility', $this->step( $shopping, 'launched' )['link']['text'] );
}
/**
@@ -661,7 +661,7 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
public function test_output_couldnt_check_message_follows_coming_soon(): void {
StoreConditionsTest::make_store_ready( $this );
$sitemap = array(
- 'id' => 'sitemap_xml',
+ 'id' => 'sitemap_lists_products',
'group' => 'find',
'ok' => null,
'level' => 'recommended',
@@ -677,13 +677,13 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
'fix_url' => '',
);
update_option( AgentReadiness::REPORT_OPTION, array( 'store_checks' => array( $sitemap, $robots ) ), false );
- $this->assertSame( 'This couldn\'t be checked. The next check tries again.', $this->row( 'Sitemap lists your products' )['text'] );
+ $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 );
$card = array_column( $this->view()['sections'], null, 'id' )['find'];
- $this->assertSame( 'Couldn’t check', $card['badge']['text'] );
- $this->assertSame( array( 'We couldn’t check your pages' ), array_column( $card['rows'], 'title' ), 'One row for the card, not one per check' );
- $this->assertSame( 'Your hosting setup blocked the check from opening them. Try again later, or contact your hosting provider.', $card['rows'][0]['text'] );
+ $this->assertSame( 'Not checked yet', $card['badge']['text'] );
+ $this->assertSame( array( 'Your pages couldn’t be checked' ), array_column( $card['rows'], 'title' ), 'One row for the card, not one per 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'];
@@ -709,7 +709,7 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
update_option( 'woocommerce_coming_soon', 'yes' );
$notice = $this->view()['coming_soon'];
$this->assertSame( 'Your store is in coming soon mode, so AI assistants can’t find your products yet. These results are from when your store was live.', $notice['text'] );
- $this->assertSame( 'Change store visibility', $notice['link']['text'], 'The same button as the AI shopping notice' );
+ $this->assertSame( 'Change site visibility', $notice['link']['text'], 'The same button as the AI shopping notice' );
$this->assertStringContainsString( 'site-visibility', $notice['link']['href'] );
update_option( AgentReadiness::REPORT_OPTION, array( 'store_checks' => array( $launched( false ) ) ), false );
@@ -939,7 +939,7 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
$this->assertSame(
array(
'intent' => 'none',
- 'text' => 'Couldn’t check',
+ 'text' => 'Not checked yet',
),
array_column( $view['sections'], 'badge', 'id' )['find'],
'Not counted as a result; the passing search engine step isn\'t in the card'
@@ -1210,8 +1210,8 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
);
update_option( AgentReadiness::REPORT_OPTION, $report );
$fix_first = $this->view()['fix_first'];
- $this->assertSame( 'Analytics hasn\'t imported all your past orders yet, so issues are ranked by how many products and AI apps they affect.', $fix_first['ranking'], 'Missing orders don\'t read as no sales' );
- $this->assertSame( 'Import your past orders in Analytics settings', $fix_first['link']['text'], 'The link goes where the import is' );
+ $this->assertSame( 'Start with the fixes that affect the most products. Sales rankings start once Analytics has imported your past orders.', $fix_first['ranking'], 'Missing orders don\'t read as no sales' );
+ $this->assertSame( 'Import past orders', $fix_first['link']['text'], 'The link goes where the import is' );
$this->assertStringEndsWith( 'admin.php?page=wc-admin&path=/analytics/settings', $fix_first['link']['href'] );
unset( $report['sales'] );
@@ -1295,7 +1295,7 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
$sections = array_column( $this->view()['sections'], null, 'id' );
foreach ( array( 'products', 'understand' ) as $id ) {
- $this->assertSame( 'Couldn’t check', $sections[ $id ]['badge']['text'], $id . ' has no checks; its text says why' );
+ $this->assertSame( 'Not checked yet', $sections[ $id ]['badge']['text'], $id . ' has no checks; its text says why' );
$this->assertSame( array(), array_merge( $sections[ $id ]['rows'], $sections[ $id ]['folded'] ) );
$this->assertSame( 'You don’t have any products yet', $sections[ $id ]['empty']['title'] );
$this->assertSame( 'Add a product', $sections[ $id ]['empty']['link']['text'] );
@@ -1331,7 +1331,7 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
private function assert_products_are_unreadable(): void {
$sections = array_column( $this->view()['sections'], null, 'id' );
foreach ( array( 'products', 'understand' ) as $id ) {
- $this->assertSame( 'Couldn’t check', $sections[ $id ]['badge']['text'], $id );
+ $this->assertSame( 'Not checked yet', $sections[ $id ]['badge']['text'], $id );
$this->assertSame( 'None of your products can be checked yet', $sections[ $id ]['empty']['title'] );
$this->assertSame( 'View product visibility', $sections[ $id ]['empty']['link']['text'] );
$this->assertStringContainsString( 'section=' . AgenticCommerceSettings::SHOPPING_SECTION, $sections[ $id ]['empty']['link']['href'] );
@@ -1462,21 +1462,20 @@ 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 Couldn't check; before the first check, Not checked yet.
+ * @testdox A question's badge counts its issues; when nothing failed but a check couldn't run, it says Not checked yet.
*/
public function test_group_badge(): void {
$badge = new \ReflectionMethod( ReadinessCheckPage::class, 'group_badge' );
$badge->setAccessible( true );
- $text = static fn( array $checks, bool $checked = true ): string => $badge->invoke( null, $checks, $checked )[1];
+ $text = static fn( array $checks ): string => $badge->invoke( null, $checks )[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( '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( 'Couldn’t check', $text( array() ) );
- $this->assertSame( 'Not checked yet', $text( array( $row( null ) ), false ), 'Before the first check' );
+ $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() ) );
$map = new \ReflectionMethod( ReadinessCheckPage::class, 'badge_data' );
$map->setAccessible( true );
@@ -1543,6 +1542,12 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
'The count reads as one line, with no link of its own'
);
$this->assertStringStartsWith( 'Last checked today at ', $view['last_checked'] );
+ $last = new \ReflectionMethod( ReadinessCheckPage::class, 'last_checked' );
+ $last->setAccessible( true );
+ update_option( 'date_format', 'F j, Y' );
+ update_option( 'time_format', 'g:i a' );
+ update_option( 'timezone_string', 'UTC' );
+ $this->assertSame( 'Last checked November 18, 2026 at 9:14 am. Checks run each day.', $last->invoke( null, array( 'generated_at' => '2026-11-18T09:14:00+00:00' ) ), 'An earlier day reads as a date, then at and the time' );
$this->assertNotNull( $view['fix_first'], 'When it last ran, Fix first, then a card per question' );
$brand = $this->row( 'Add a brand to ' . $product->get_name() );
$this->assertSame( 'ChatGPT only lists products that have a brand. In Google and Copilot, a brand makes products easier to find.', $brand['text'], 'One failing product is named in the title; the text says why a brand matters' );
@@ -1632,7 +1637,7 @@ class AgenticCommerceSettingsTest extends WC_Unit_Test_Case {
$this->assertSame(
array(
'intent' => 'none',
- 'text' => 'Couldn’t check',
+ 'text' => 'Not checked yet',
),
$badges['access'],
'With AI shopping off and no scanned access check, the card has nothing checked; setup steps stay out'
diff --git a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ProductsListTest.php b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ProductsListTest.php
index 10eae3696a5..80900ba6ce7 100644
--- a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ProductsListTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ProductsListTest.php
@@ -326,6 +326,36 @@ class ProductsListTest extends WC_Unit_Test_Case {
$this->assertSame( array(), ProductFailures::for_product( $product->get_id() ) );
}
+ /**
+ * @testdox The Products list says when it shows only the products from an AI shopping health link, and links to all products.
+ */
+ public function test_filter_notice(): void {
+ $notice = function (): string {
+ ob_start();
+ $this->sut->filter_notice();
+ return (string) ob_get_clean();
+ };
+ $GLOBALS['current_screen'] = \WP_Screen::get( 'edit-product' ); // phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
+ try {
+ $this->assertSame( '', $notice(), 'No notice on the usual list' );
+
+ $_GET[ ProductsList::FILTER_PARAM ] = 'missing_images';
+ $html = $notice();
+ $this->assertStringContainsString( 'Showing products from AI shopping health.', $html );
+ $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 {
+ unset( $GLOBALS['current_screen'], $_GET[ ProductsList::FILTER_PARAM ] );
+ }
+ }
+
/**
* @testdox The filter limits the main Products list query, and only there.
*/
diff --git a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessRestControllerTest.php b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessRestControllerTest.php
index 3fc7611fde9..4c543bb5eaa 100644
--- a/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessRestControllerTest.php
+++ b/plugins/woocommerce/tests/php/src/Internal/AgentReadiness/ReadinessRestControllerTest.php
@@ -317,7 +317,7 @@ class ReadinessRestControllerTest extends WC_REST_Unit_Test_Case {
$this->assertStringContainsString( 'Hidden: 1', $text );
$this->assertStringContainsString( 'Not supported: 2', $text );
$this->assertMatchesRegularExpression( '/^[^\n]*\(search_visible\): ❌ AI assistants /m', $text, 'A failing setup step uses the page\'s words.' );
- $this->assertStringNotContainsString( 'couldn’t check your pages', $text, 'Some checks ran.' );
+ $this->assertStringNotContainsString( 'Your pages couldn’t be checked', $text, 'Some checks ran.' );
$this->assertMatchesRegularExpression( '/^[^\n]*\(ucp_on\): ❌ Some checks only run when AI shopping is on/m', $text );
$this->assertMatchesRegularExpression( '/^llms\.txt \(llms_txt_present\): ❌ \S[^\n]*Store response: 404 text\/html$/m', $text );
$this->assertMatchesRegularExpression( '/^Sitemap lists products \(sitemap_lists_products\): Couldn’t check( \(not shown on the page\))?$/m', $text );
@@ -372,8 +372,8 @@ class ReadinessRestControllerTest extends WC_REST_Unit_Test_Case {
$text = $this->server->dispatch( new WP_REST_Request( 'GET', '/wc/v3/agent-readiness/support-report' ) )->get_data()['text'];
- $this->assertStringContainsString( "### Store checks ###\n\nWe couldn’t check your pages. Your hosting setup blocked the check from opening them.", $text );
- $this->assertSame( 1, substr_count( $text, 'couldn’t check your pages' ) );
+ $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' ) );
}
/**