diff --git a/plugins/woocommerce/changelog/tweak-add-admin-install-timestamp-tracker b/plugins/woocommerce/changelog/tweak-add-admin-install-timestamp-tracker new file mode 100644 index 00000000000..1d2843e24db --- /dev/null +++ b/plugins/woocommerce/changelog/tweak-add-admin-install-timestamp-tracker @@ -0,0 +1,4 @@ +Significance: minor +Type: tweak + +Add admin_install_timestamp in WC_Tracker diff --git a/plugins/woocommerce/includes/class-wc-tracker.php b/plugins/woocommerce/includes/class-wc-tracker.php index f41f30fbab1..5ee937b6e1a 100644 --- a/plugins/woocommerce/includes/class-wc-tracker.php +++ b/plugins/woocommerce/includes/class-wc-tracker.php @@ -965,6 +965,7 @@ class WC_Tracker { 'hpos_transactions_enabled' => get_option( 'woocommerce_use_db_transactions_for_custom_orders_table_data_sync' ), 'hpos_transactions_level' => get_option( 'woocommerce_db_transactions_isolation_level_for_custom_orders_table_data_sync' ), 'show_marketplace_suggestions' => get_option( 'woocommerce_show_marketplace_suggestions' ), + 'admin_install_timestamp' => get_option( 'woocommerce_admin_install_timestamp' ), ); } diff --git a/plugins/woocommerce/tests/php/includes/class-wc-tracker-test.php b/plugins/woocommerce/tests/php/includes/class-wc-tracker-test.php index a88bcf39dc4..a99c19ffad6 100644 --- a/plugins/woocommerce/tests/php/includes/class-wc-tracker-test.php +++ b/plugins/woocommerce/tests/php/includes/class-wc-tracker-test.php @@ -231,4 +231,16 @@ class WC_Tracker_Test extends \WC_Unit_Test_Case { $this->assertEquals( '12345', $tracking_data['store_id'] ); delete_option( \WC_Install::STORE_ID_OPTION ); } + + /** + * @testDox Test woocommerce_install_admin_timestamp is included in tracking data. + */ + public function test_get_tracking_data_admin_install_timestamp() { + $time = time(); + update_option( 'woocommerce_admin_install_timestamp', $time ); + $tracking_data = WC_Tracker::get_tracking_data(); + $this->assertArrayHasKey( 'admin_install_timestamp', $tracking_data['settings'] ); + $this->assertEquals( $tracking_data['settings']['admin_install_timestamp'], $time ); + delete_option( 'woocommerce_admin_install_timestamp' ); + } }