Update product task experiment names to re-run (#34495)

* Update product task experiment names to re-run experiment

* Add spotlight parameter experimental product task menu

* Changelog

* Fix yoda
This commit is contained in:
Ilyas Foo 2022-08-29 14:19:59 +08:00 committed by GitHub
parent ea8b44115b
commit c7015da14e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 6 deletions

View File

@ -36,9 +36,12 @@ export const useCreateProductByType = () => {
{ _fields: [ 'id' ] }
);
if ( data && data.id ) {
const link = getAdminLink(
let link = getAdminLink(
`post.php?post=${ data.id }&action=edit&wc_onboarding_active_task=products&tutorial=true`
);
if ( type === 'physical' ) {
link += '&spotlight=true';
}
window.location.href = link;
} else {
throw new Error( 'Unexpected empty data response from server' );

View File

@ -8,9 +8,9 @@ type Layout = 'control' | 'card' | 'stacked';
export const getProductLayoutExperiment = async (): Promise< Layout > => {
const [ cardAssignment, stackedAssignment ] = await Promise.all( [
loadExperimentAssignment( `woocommerce_products_task_layout_card_v2` ),
loadExperimentAssignment( `woocommerce_products_task_layout_card_v3` ),
loadExperimentAssignment(
`woocommerce_products_task_layout_stacked_v2`
`woocommerce_products_task_layout_stacked_v3`
),
] );
// This logic may look flawed as in both looks like they can be assigned treatment at the same time,

View File

@ -0,0 +1,4 @@
Significance: patch
Type: tweak
Update product task experiment names and add spotlight parameter to physical product template link

View File

@ -362,14 +362,14 @@ class OnboardingTasks extends \WC_REST_Data_Controller {
*/
public static function is_experiment_product_task() {
$anon_id = isset( $_COOKIE['tk_ai'] ) ? sanitize_text_field( wp_unslash( $_COOKIE['tk_ai'] ) ) : '';
$allow_tracking = 'yes' === get_option( 'woocommerce_allow_tracking' );
$allow_tracking = get_option( 'woocommerce_allow_tracking' ) === 'yes';
$abtest = new \WooCommerce\Admin\Experimental_Abtest(
$anon_id,
'woocommerce',
$allow_tracking
);
return $abtest->get_variation( 'woocommerce_products_task_layout_stacked_v2' ) === 'treatment' ||
$abtest->get_variation( 'woocommerce_products_task_layout_card_v2' ) === 'treatment';
return $abtest->get_variation( 'woocommerce_products_task_layout_stacked_v3' ) === 'treatment' ||
$abtest->get_variation( 'woocommerce_products_task_layout_card_v3' ) === 'treatment';
}
/**