diff --git a/plugins/woocommerce-admin/src/FeaturePlugin.php b/plugins/woocommerce-admin/src/FeaturePlugin.php index a968078d5a9..6ed2e9537e9 100644 --- a/plugins/woocommerce-admin/src/FeaturePlugin.php +++ b/plugins/woocommerce-admin/src/FeaturePlugin.php @@ -17,6 +17,7 @@ use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Tracking_Opt_In; use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_WooCommerce_Payments; use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Install_JP_And_WCS_Plugins; use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Draw_Attention; +use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_First_Order; use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\RemoteInboxNotificationsEngine; use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Home_Screen_Feedback; @@ -190,6 +191,7 @@ class FeaturePlugin { new WC_Admin_Notes_WooCommerce_Payments(); new WC_Admin_Notes_Install_JP_And_WCS_Plugins(); new WC_Admin_Notes_Draw_Attention(); + new WC_Admin_Notes_First_Order(); new WC_Admin_Notes_Home_Screen_Feedback(); // Initialize RemoteInboxNotificationsEngine. diff --git a/plugins/woocommerce-admin/src/Notes/WC_Admin_Notes_First_Order.php b/plugins/woocommerce-admin/src/Notes/WC_Admin_Notes_First_Order.php new file mode 100644 index 00000000000..43c4595dbbe --- /dev/null +++ b/plugins/woocommerce-admin/src/Notes/WC_Admin_Notes_First_Order.php @@ -0,0 +1,77 @@ +post_type ) { + return; + } + + // Only add this note if no previous orders exist. + $query = new \WC_Order_Query( + array( + 'limit' => 2, + ) + ); + $orders = $query->get_orders(); + + if ( count( $orders ) !== 1 ) { + return; + } + + self::possibly_add_note(); + } + + /** + * Get the note. + */ + public static function get_note() { + $content = __( "Congratulations on getting your first order! Now it's a great time to learn how to manage your orders.", 'woocommerce-admin' ); + + $note = new WC_Admin_Note(); + $note->set_title( __( 'First order received', 'woocommerce-admin' ) ); + $note->set_content( $content ); + $note->set_content_data( (object) array() ); + $note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); + $note->set_name( self::NOTE_NAME ); + $note->set_source( 'woocommerce-admin' ); + $note->add_action( 'learn-more', __( 'Learn more', 'woocommerce-admin' ), 'https://docs.woocommerce.com/document/managing-orders/?utm_source=inbox' ); + return $note; + } +}