Merge pull request #29894 from woocommerce/add/woocommerce_inbox_variant

Add psuedo random option for remote inbox note A/B tests
This commit is contained in:
Roy Ho 2021-05-19 11:26:50 -07:00 committed by GitHub
commit 61acb089c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 0 deletions

View File

@ -205,6 +205,8 @@ final class WooCommerce {
add_action( 'switch_blog', array( $this, 'wpdb_table_fix' ), 0 ); add_action( 'switch_blog', array( $this, 'wpdb_table_fix' ), 0 );
add_action( 'activated_plugin', array( $this, 'activated_plugin' ) ); add_action( 'activated_plugin', array( $this, 'activated_plugin' ) );
add_action( 'deactivated_plugin', array( $this, 'deactivated_plugin' ) ); add_action( 'deactivated_plugin', array( $this, 'deactivated_plugin' ) );
add_action( 'woocommerce_installed', array( $this, 'add_woocommerce_inbox_variant' ) );
add_action( 'woocommerce_updated', array( $this, 'add_woocommerce_inbox_variant' ) );
// These classes set up hooks on instantiation. // These classes set up hooks on instantiation.
wc_get_container()->get( DownloadPermissionsAdjuster::class ); wc_get_container()->get( DownloadPermissionsAdjuster::class );
@ -212,6 +214,17 @@ final class WooCommerce {
wc_get_container()->get( DataRegenerator::class ); wc_get_container()->get( DataRegenerator::class );
} }
/**
* Add woocommerce_inbox_variant for the Remote Inbox Notification.
*
* P2 post can be found at https://wp.me/paJDYF-1uJ.
*/
public function add_woocommerce_inbox_variant() {
$config_name = 'woocommerce_inbox_variant_assignment';
if ( false === get_option( $config_name, false ) ) {
update_option( $config_name, wp_rand( 1, 12 ) );
}
}
/** /**
* Ensures fatal errors are logged so they can be picked up in the status report. * Ensures fatal errors are logged so they can be picked up in the status report.
* *