diff --git a/plugins/woocommerce-admin/client/tasks/fills/Marketing/index.tsx b/plugins/woocommerce-admin/client/tasks/fills/Marketing/index.tsx index fee0dcb1d7b..1eb1a9eb5a8 100644 --- a/plugins/woocommerce-admin/client/tasks/fills/Marketing/index.tsx +++ b/plugins/woocommerce-admin/client/tasks/fills/Marketing/index.tsx @@ -54,7 +54,11 @@ export const getMarketingExtensionLists = ( ): [ PluginProps[], PluginListProps[] ] => { const installed: PluginProps[] = []; const lists: PluginListProps[] = []; - freeExtensions.forEach( ( list ) => { + const freeExtensionsRandomized: ExtensionList[] = freeExtensions.sort( + () => Math.random() - 0.5 + ); // Randomize the order sections appear. + + freeExtensionsRandomized.forEach( ( list ) => { if ( ! ALLOWED_PLUGIN_LISTS.includes( list.key ) ) { return; } @@ -133,6 +137,9 @@ const Marketing: React.FC< MarketingProps > = ( { onComplete } ) => { installed_extensions: installedExtensions.map( ( extension ) => extension.slug ), + section_order: pluginLists + .map( ( list ) => list.key ) + .join( ', ' ), } ); createNoticesFromResponse( response ); diff --git a/plugins/woocommerce-admin/client/tasks/fills/Marketing/test/index.tsx b/plugins/woocommerce-admin/client/tasks/fills/Marketing/test/index.tsx index addbdb2a1dc..27a665ce4b2 100644 --- a/plugins/woocommerce-admin/client/tasks/fills/Marketing/test/index.tsx +++ b/plugins/woocommerce-admin/client/tasks/fills/Marketing/test/index.tsx @@ -117,10 +117,11 @@ describe( 'getMarketingExtensionLists', () => { [], [] ); + const listKeys = lists.map( ( list ) => list.key ); expect( lists.length ).toBe( 2 ); - expect( lists[ 0 ].key ).toBe( 'task-list/reach' ); - expect( lists[ 1 ].key ).toBe( 'task-list/grow' ); + expect( listKeys ).toContain( 'task-list/reach' ); + expect( listKeys ).toContain( 'task-list/grow' ); } ); test( 'should separate installed plugins', () => { diff --git a/plugins/woocommerce/changelog/add-randomize-marketing-tasklist b/plugins/woocommerce/changelog/add-randomize-marketing-tasklist new file mode 100644 index 00000000000..3eb054553e1 --- /dev/null +++ b/plugins/woocommerce/changelog/add-randomize-marketing-tasklist @@ -0,0 +1,4 @@ +Significance: minor +Type: update + +Randomize the order of sections in Recommended Marketing Extensions