diff --git a/plugins/woocommerce-admin/client/core-profiler/index.tsx b/plugins/woocommerce-admin/client/core-profiler/index.tsx index 428566a4578..8dbcd742f3f 100644 --- a/plugins/woocommerce-admin/client/core-profiler/index.tsx +++ b/plugins/woocommerce-admin/client/core-profiler/index.tsx @@ -300,15 +300,28 @@ const exitToWooHome = fromPromise( async () => { window.location.href = getNewPath( {}, '/', {} ); } ); +const getPluginNameParam = ( + pluginsSelected: CoreProfilerStateMachineContext[ 'pluginsSelected' ] +) => { + if ( pluginsSelected.includes( 'woocommerce-payments' ) ) { + return 'woocommerce-payments'; + } + return 'jetpack-ai'; +}; + const redirectToJetpackAuthPage = ( { event, + context, }: { context: CoreProfilerStateMachineContext; event: { output: { url: string } }; } ) => { const url = new URL( event.output.url ); url.searchParams.set( 'installed_ext_success', '1' ); - url.searchParams.set( 'plugin_name', 'jetpack-ai' ); + url.searchParams.set( + 'plugin_name', + getPluginNameParam( context.pluginsSelected ) + ); window.location.href = url.toString(); }; diff --git a/plugins/woocommerce/changelog/update-dynamically-set-plugin-name b/plugins/woocommerce/changelog/update-dynamically-set-plugin-name new file mode 100644 index 00000000000..079eb126b45 --- /dev/null +++ b/plugins/woocommerce/changelog/update-dynamically-set-plugin-name @@ -0,0 +1,4 @@ +Significance: patch +Type: update + +Dynamically set plugin_name when redirecting to Jetpack Auth from core profiler