From a43bcaca0f7f31e2c564dd83a768ac484371c5c0 Mon Sep 17 00:00:00 2001 From: Chi-Hsuan Huang Date: Wed, 22 Dec 2021 13:11:10 +0800 Subject: [PATCH] Remove low performing inbox notes (https://github.com/woocommerce/woocommerce-admin/pull/8054) * Remove Marketing note * Remove DrawAttention note Remove DrawAttention note * Remove NeedSomeInspiration note * Remove ChooseNiche note * Remove StartDropshippingBusiness note * Remove FilterByProductVariationsInReports note * Remove LearnMoreAboutVariableProducts note * Remove GettingStartedInEcommerceWebinar note * Remove deprecated note tests * Add changelogs Update changelogs * Remove navigation feedback notes (https://github.com/woocommerce/woocommerce-admin/pull/8055) * Remove navigation feedback note issue woocommerce/woocommerce-admin#8043 * Add changelogs --- .../remove-5475-navigation-feedback-notes | 4 + .../remove-7970-low-performing-inbox-notes | 4 + plugins/woocommerce-admin/src/Events.php | 20 --- .../woocommerce-admin/src/FeaturePlugin.php | 4 - plugins/woocommerce-admin/src/Install.php | 10 ++ .../src/Notes/ChooseNiche.php | 82 --------- .../src/Notes/DeprecatedNotes.php | 105 ----------- .../src/Notes/DrawAttention.php | 75 -------- .../FilterByProductVariationsInReports.php | 77 -------- .../GettingStartedInEcommerceWebinar.php | 82 --------- .../Notes/LearnMoreAboutVariableProducts.php | 83 --------- .../woocommerce-admin/src/Notes/Marketing.php | 53 ------ .../src/Notes/NavigationFeedback.php | 56 ------ .../src/Notes/NavigationFeedbackFollowUp.php | 70 -------- .../src/Notes/NeedSomeInspiration.php | 68 ------- .../src/Notes/StartDropshippingBusiness.php | 82 --------- .../tests/notes/class-wc-marketing.php | 54 ------ ...ests-learn-more-about-variable-product.php | 169 ------------------ 18 files changed, 18 insertions(+), 1080 deletions(-) create mode 100644 plugins/woocommerce-admin/changelogs/remove-5475-navigation-feedback-notes create mode 100644 plugins/woocommerce-admin/changelogs/remove-7970-low-performing-inbox-notes delete mode 100644 plugins/woocommerce-admin/src/Notes/ChooseNiche.php delete mode 100644 plugins/woocommerce-admin/src/Notes/DrawAttention.php delete mode 100644 plugins/woocommerce-admin/src/Notes/FilterByProductVariationsInReports.php delete mode 100644 plugins/woocommerce-admin/src/Notes/GettingStartedInEcommerceWebinar.php delete mode 100644 plugins/woocommerce-admin/src/Notes/LearnMoreAboutVariableProducts.php delete mode 100644 plugins/woocommerce-admin/src/Notes/Marketing.php delete mode 100644 plugins/woocommerce-admin/src/Notes/NavigationFeedback.php delete mode 100644 plugins/woocommerce-admin/src/Notes/NavigationFeedbackFollowUp.php delete mode 100644 plugins/woocommerce-admin/src/Notes/NeedSomeInspiration.php delete mode 100644 plugins/woocommerce-admin/src/Notes/StartDropshippingBusiness.php delete mode 100644 plugins/woocommerce-admin/tests/notes/class-wc-marketing.php delete mode 100644 plugins/woocommerce-admin/tests/notes/class-wc-tests-learn-more-about-variable-product.php diff --git a/plugins/woocommerce-admin/changelogs/remove-5475-navigation-feedback-notes b/plugins/woocommerce-admin/changelogs/remove-5475-navigation-feedback-notes new file mode 100644 index 00000000000..55693d1ff8b --- /dev/null +++ b/plugins/woocommerce-admin/changelogs/remove-5475-navigation-feedback-notes @@ -0,0 +1,4 @@ +Significance: minor +Type: Dev + +Remove navigation feedback note. #8055 diff --git a/plugins/woocommerce-admin/changelogs/remove-7970-low-performing-inbox-notes b/plugins/woocommerce-admin/changelogs/remove-7970-low-performing-inbox-notes new file mode 100644 index 00000000000..c2439e6151e --- /dev/null +++ b/plugins/woocommerce-admin/changelogs/remove-7970-low-performing-inbox-notes @@ -0,0 +1,4 @@ +Significance: minor +Type: Dev + +Remove low performing inbox notes. #8054 diff --git a/plugins/woocommerce-admin/src/Events.php b/plugins/woocommerce-admin/src/Events.php index b7324a3ab89..69c38bab207 100644 --- a/plugins/woocommerce-admin/src/Events.php +++ b/plugins/woocommerce-admin/src/Events.php @@ -10,7 +10,6 @@ defined( 'ABSPATH' ) || exit; use \Automattic\WooCommerce\Admin\Features\Features; use \Automattic\WooCommerce\Admin\Notes\AddingAndManangingProducts; -use \Automattic\WooCommerce\Admin\Notes\ChooseNiche; use \Automattic\WooCommerce\Admin\Notes\ChoosingTheme; use \Automattic\WooCommerce\Admin\Notes\CustomizingProductCatalog; use Automattic\WooCommerce\Admin\Notes\FirstDownlaodableProduct; @@ -23,9 +22,7 @@ use \Automattic\WooCommerce\Admin\Notes\OnboardingPayments; use \Automattic\WooCommerce\Admin\Notes\PersonalizeStore; use \Automattic\WooCommerce\Admin\Notes\EUVATNumber; use \Automattic\WooCommerce\Admin\Notes\WooCommercePayments; -use \Automattic\WooCommerce\Admin\Notes\Marketing; use \Automattic\WooCommerce\Admin\Notes\MarketingJetpack; -use \Automattic\WooCommerce\Admin\Notes\StartDropshippingBusiness; use \Automattic\WooCommerce\Admin\Notes\WooCommerceSubscriptions; use \Automattic\WooCommerce\Admin\Notes\MigrateFromShopify; use \Automattic\WooCommerce\Admin\Notes\LaunchChecklist; @@ -34,7 +31,6 @@ use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\DataSourcePoller; use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\RemoteInboxNotificationsEngine; use \Automattic\WooCommerce\Admin\Notes\MerchantEmailNotifications\MerchantEmailNotifications; use \Automattic\WooCommerce\Admin\Notes\InsightFirstSale; -use \Automattic\WooCommerce\Admin\Notes\NeedSomeInspiration; use \Automattic\WooCommerce\Admin\Notes\OnlineClothingStore; use \Automattic\WooCommerce\Admin\Notes\FirstProduct; use \Automattic\WooCommerce\Admin\Notes\CustomizeStoreWithBlocks; @@ -42,12 +38,7 @@ use \Automattic\WooCommerce\Admin\Notes\TestCheckout; use \Automattic\WooCommerce\Admin\Notes\EditProductsOnTheMove; use \Automattic\WooCommerce\Admin\Notes\PerformanceOnMobile; use \Automattic\WooCommerce\Admin\Notes\ManageOrdersOnTheGo; -use \Automattic\WooCommerce\Admin\Notes\NavigationFeedback; -use \Automattic\WooCommerce\Admin\Notes\NavigationFeedbackFollowUp; -use \Automattic\WooCommerce\Admin\Notes\FilterByProductVariationsInReports; use \Automattic\WooCommerce\Admin\Notes\AddFirstProduct; -use \Automattic\WooCommerce\Admin\Notes\DrawAttention; -use \Automattic\WooCommerce\Admin\Notes\GettingStartedInEcommerceWebinar; use \Automattic\WooCommerce\Admin\Notes\NavigationNudge; use Automattic\WooCommerce\Admin\Schedulers\MailchimpScheduler; use \Automattic\WooCommerce\Admin\Notes\CompleteStoreDetails; @@ -125,33 +116,24 @@ class Events { PersonalizeStore::possibly_add_note(); WooCommercePayments::possibly_add_note(); EUVATNumber::possibly_add_note(); - Marketing::possibly_add_note(); MarketingJetpack::possibly_add_note(); - StartDropshippingBusiness::possibly_add_note(); WooCommerceSubscriptions::possibly_add_note(); MigrateFromShopify::possibly_add_note(); InsightFirstSale::possibly_add_note(); LaunchChecklist::possibly_add_note(); - NeedSomeInspiration::possibly_add_note(); OnlineClothingStore::possibly_add_note(); FirstProduct::possibly_add_note(); - ChooseNiche::possibly_add_note(); RealTimeOrderAlerts::possibly_add_note(); CustomizeStoreWithBlocks::possibly_add_note(); TestCheckout::possibly_add_note(); EditProductsOnTheMove::possibly_add_note(); PerformanceOnMobile::possibly_add_note(); ManageOrdersOnTheGo::possibly_add_note(); - NavigationFeedback::possibly_add_note(); - NavigationFeedbackFollowUp::possibly_add_note(); - FilterByProductVariationsInReports::possibly_add_note(); - DrawAttention::possibly_add_note(); ChoosingTheme::possibly_add_note(); InsightFirstProductAndPayment::possibly_add_note(); AddFirstProduct::possibly_add_note(); AddingAndManangingProducts::possibly_add_note(); CustomizingProductCatalog::possibly_add_note(); - GettingStartedInEcommerceWebinar::possibly_add_note(); FirstDownlaodableProduct::possibly_add_note(); NavigationNudge::possibly_add_note(); CompleteStoreDetails::possibly_add_note(); @@ -163,8 +145,6 @@ class Events { */ protected function possibly_delete_notes() { NavigationNudge::delete_if_not_applicable(); - NavigationFeedback::delete_if_not_applicable(); - NavigationFeedbackFollowUp::delete_if_not_applicable(); SetUpAdditionalPaymentTypes::delete_if_not_applicable(); } diff --git a/plugins/woocommerce-admin/src/FeaturePlugin.php b/plugins/woocommerce-admin/src/FeaturePlugin.php index e41f59372aa..b90c169319c 100644 --- a/plugins/woocommerce-admin/src/FeaturePlugin.php +++ b/plugins/woocommerce-admin/src/FeaturePlugin.php @@ -7,14 +7,12 @@ namespace Automattic\WooCommerce\Admin; defined( 'ABSPATH' ) || exit; -use \Automattic\WooCommerce\Admin\Notes\LearnMoreAboutVariableProducts; use \Automattic\WooCommerce\Admin\Notes\Notes; use \Automattic\WooCommerce\Admin\Notes\OrderMilestones; use \Automattic\WooCommerce\Admin\Notes\WooSubscriptionsNotes; use \Automattic\WooCommerce\Admin\Notes\TrackingOptIn; use \Automattic\WooCommerce\Admin\Notes\WooCommercePayments; use \Automattic\WooCommerce\Admin\Notes\InstallJPAndWCSPlugins; -use \Automattic\WooCommerce\Admin\Notes\DrawAttention; use \Automattic\WooCommerce\Admin\Notes\SetUpAdditionalPaymentTypes; use \Automattic\WooCommerce\Admin\Notes\TestCheckout; use \Automattic\WooCommerce\Admin\Notes\SellingOnlineCourses; @@ -188,11 +186,9 @@ class FeaturePlugin { new TrackingOptIn(); new WooCommercePayments(); new InstallJPAndWCSPlugins(); - new DrawAttention(); new SetUpAdditionalPaymentTypes(); new TestCheckout(); new SellingOnlineCourses(); - new LearnMoreAboutVariableProducts(); new WelcomeToWooCommerceForStoreUsers(); new ManageStoreActivityFromHomeScreen(); new NavigationNudge(); diff --git a/plugins/woocommerce-admin/src/Install.php b/plugins/woocommerce-admin/src/Install.php index 5bcad7bd2ee..ba96460cc40 100644 --- a/plugins/woocommerce-admin/src/Install.php +++ b/plugins/woocommerce-admin/src/Install.php @@ -543,6 +543,16 @@ class Install { 'wc-admin-home-screen-feedback', 'wc-admin-effortless-payments-by-mollie', 'wc-admin-google-ads-and-marketing', + 'wc-admin-marketing-intro', + 'wc-admin-draw-attention', + 'wc-admin-need-some-inspiration', + 'wc-admin-choose-niche', + 'wc-admin-start-dropshipping-business', + 'wc-admin-filter-by-product-variations-in-reports', + 'wc-admin-learn-more-about-variable-products', + 'wc-admin-getting-started-ecommerce-webinar', + 'wc-admin-navigation-feedback', + 'wc-admin-navigation-feedback-follow-up', ); $additional_obsolete_notes_names = apply_filters( diff --git a/plugins/woocommerce-admin/src/Notes/ChooseNiche.php b/plugins/woocommerce-admin/src/Notes/ChooseNiche.php deleted file mode 100644 index 23b71fe44c2..00000000000 --- a/plugins/woocommerce-admin/src/Notes/ChooseNiche.php +++ /dev/null @@ -1,82 +0,0 @@ -set_title( __( 'Finding an audience for your business', 'woocommerce-admin' ) ); - $note->set_content( __( 'There’s nothing quite like entrepreneurship! We put together a blog post series — titled From Idea to First Customer — with all the tips, resources, and tools to inspire a great idea, empower you to execute it, and lead to your very first sale.', 'woocommerce-admin' ) ); - $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); - $note->set_name( self::NOTE_NAME ); - $note->set_content_data( (object) array() ); - $note->set_source( 'woocommerce-admin' ); - $note->add_action( - 'choose-niche', - __( 'Learn more', 'woocommerce-admin' ), - 'https://woocommerce.com/from-idea-to-first-customer/?utm_source=inbox&utm_medium=product', - Note::E_WC_ADMIN_NOTE_ACTIONED, - true - ); - return $note; - } -} diff --git a/plugins/woocommerce-admin/src/Notes/DeprecatedNotes.php b/plugins/woocommerce-admin/src/Notes/DeprecatedNotes.php index d3290a357cc..0f1dc4931af 100644 --- a/plugins/woocommerce-admin/src/Notes/DeprecatedNotes.php +++ b/plugins/woocommerce-admin/src/Notes/DeprecatedNotes.php @@ -76,27 +76,6 @@ class WC_Admin_Notes extends DeprecatedClassFacade { protected static $deprecated_in_version = '1.7.0'; } -/** - * WC_Admin_Notes_Choose_Niche. - * - * @deprecated since 1.7.0, use ChooseNiche - */ -class WC_Admin_Notes_Choose_Niche extends DeprecatedClassFacade { - /** - * The name of the non-deprecated class that this facade covers. - * - * @var string - */ - protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\ChooseNiche'; - - /** - * The version that this class was deprecated in. - * - * @var string - */ - protected static $deprecated_in_version = '1.7.0'; -} - /** * WC_Admin_Notes_Coupon_Page_Moved. * @@ -160,27 +139,6 @@ class WC_Admin_Notes_Deactivate_Plugin extends DeprecatedClassFacade { protected static $deprecated_in_version = '1.7.0'; } -/** - * WC_Admin_Notes_Draw_Attention. - * - * @deprecated since 1.7.0, use DrawAttention - */ -class WC_Admin_Notes_Draw_Attention extends DeprecatedClassFacade { - /** - * The name of the non-deprecated class that this facade covers. - * - * @var string - */ - protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\DrawAttention'; - - /** - * The version that this class was deprecated in. - * - * @var string - */ - protected static $deprecated_in_version = '1.7.0'; -} - /** * WC_Admin_Notes_Edit_Products_On_The_Move. * @@ -349,27 +307,6 @@ class WC_Admin_Notes_Launch_Checklist extends DeprecatedClassFacade { protected static $deprecated_in_version = '1.7.0'; } -/** - * WC_Admin_Notes_Marketing. - * - * @deprecated since 1.7.0, use Marketing - */ -class WC_Admin_Notes_Marketing extends DeprecatedClassFacade { - /** - * The name of the non-deprecated class that this facade covers. - * - * @var string - */ - protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\Marketing'; - - /** - * The version that this class was deprecated in. - * - * @var string - */ - protected static $deprecated_in_version = '1.7.0'; -} - /** * WC_Admin_Notes_Migrate_From_Shopify. * @@ -412,27 +349,6 @@ class WC_Admin_Notes_Mobile_App extends DeprecatedClassFacade { protected static $deprecated_in_version = '1.7.0'; } -/** - * WC_Admin_Notes_Need_Some_Inspiration. - * - * @deprecated since 1.7.0, use NeedSomeInspiration - */ -class WC_Admin_Notes_Need_Some_Inspiration extends DeprecatedClassFacade { - /** - * The name of the non-deprecated class that this facade covers. - * - * @var string - */ - protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\NeedSomeInspiration'; - - /** - * The version that this class was deprecated in. - * - * @var string - */ - protected static $deprecated_in_version = '1.7.0'; -} - /** * WC_Admin_Notes_New_Sales_Record. * @@ -643,27 +559,6 @@ class WC_Admin_Notes_Set_Up_Additional_Payment_Types extends DeprecatedClassFaca protected static $deprecated_in_version = '1.7.0'; } -/** - * WC_Admin_Notes_Start_Dropshipping_Business. - * - * @deprecated since 1.7.0, use StartDropshippingBusiness - */ -class WC_Admin_Notes_Start_Dropshipping_Business extends DeprecatedClassFacade { - /** - * The name of the non-deprecated class that this facade covers. - * - * @var string - */ - protected static $facade_over_classname = 'Automattic\WooCommerce\Admin\Notes\StartDropshippingBusiness'; - - /** - * The version that this class was deprecated in. - * - * @var string - */ - protected static $deprecated_in_version = '1.7.0'; -} - /** * WC_Admin_Notes_Test_Checkout. * diff --git a/plugins/woocommerce-admin/src/Notes/DrawAttention.php b/plugins/woocommerce-admin/src/Notes/DrawAttention.php deleted file mode 100644 index b73eb231163..00000000000 --- a/plugins/woocommerce-admin/src/Notes/DrawAttention.php +++ /dev/null @@ -1,75 +0,0 @@ -set_title( __( 'Get noticed: how to draw attention to your online store', 'woocommerce-admin' ) ); - $note->set_content( __( 'To get you started, here are seven ways to boost your sales and avoid getting drowned out by similar, mass-produced products competing for the same buyers.', 'woocommerce-admin' ) ); - $note->set_content_data( (object) array() ); - $note->set_type( 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://woocommerce.com/posts/how-to-make-your-online-store-stand-out/?utm_source=inbox&utm_medium=product', - Note::E_WC_ADMIN_NOTE_ACTIONED, - true - ); - return $note; - } -} diff --git a/plugins/woocommerce-admin/src/Notes/FilterByProductVariationsInReports.php b/plugins/woocommerce-admin/src/Notes/FilterByProductVariationsInReports.php deleted file mode 100644 index 4025a976b89..00000000000 --- a/plugins/woocommerce-admin/src/Notes/FilterByProductVariationsInReports.php +++ /dev/null @@ -1,77 +0,0 @@ -set_title( __( 'New - filter by product variations in orders and products reports', 'woocommerce-admin' ) ); - $note->set_content( __( 'One of the most awaited features has just arrived! You can now have insights into each product variation in the orders and products reports.', 'woocommerce-admin' ) ); - $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); - $note->set_layout( 'banner' ); - $note->set_image( - plugins_url( - '/images/admin_notes/filter-by-product-variations-note.svg', - WC_ADMIN_PLUGIN_FILE - ) - ); - $note->set_name( self::NOTE_NAME ); - $note->set_content_data( (object) array() ); - $note->set_source( 'woocommerce-admin' ); - $note->add_action( - 'learn-more', - __( 'Learn more', 'woocommerce-admin' ), - 'https://docs.woocommerce.com/document/woocommerce-analytics/?utm_medium=product#variations-report' - ); - - return $note; - } - - /** - * Returns whether or not there are variable products. - * - * @return bool If there are variable products - */ - private static function are_products_with_variations() { - $query = new \WC_Product_Query( - array( - 'limit' => 1, - 'paginate' => true, - 'return' => 'ids', - 'status' => array( 'publish' ), - 'type' => array( 'variable' ), - ) - ); - $products = $query->get_products(); - $count = $products->total; - - return 0 !== $count; - } -} diff --git a/plugins/woocommerce-admin/src/Notes/GettingStartedInEcommerceWebinar.php b/plugins/woocommerce-admin/src/Notes/GettingStartedInEcommerceWebinar.php deleted file mode 100644 index 5efc5d9f739..00000000000 --- a/plugins/woocommerce-admin/src/Notes/GettingStartedInEcommerceWebinar.php +++ /dev/null @@ -1,82 +0,0 @@ - 1, - 'paginate' => true, - 'return' => 'ids', - 'status' => array( 'publish' ), - ) - ); - $products = $query->get_products(); - $count = $products->total; - - if ( 0 !== $count ) { - return; - } - - $note = new Note(); - $note->set_title( __( 'Getting Started in eCommerce - webinar', 'woocommerce-admin' ) ); - $note->set_content( __( 'We want to make eCommerce and this process of getting started as easy as possible for you. Watch this webinar to get tips on how to have our store up and running in a breeze.', 'woocommerce-admin' ) ); - $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); - $note->set_name( self::NOTE_NAME ); - $note->set_content_data( (object) array() ); - $note->set_source( 'woocommerce-admin' ); - $note->add_action( - 'getting-started-webinar', - __( 'Watch the webinar', 'woocommerce-admin' ), - 'https://youtu.be/V_2XtCOyZ7o' - ); - - return $note; - } -} diff --git a/plugins/woocommerce-admin/src/Notes/LearnMoreAboutVariableProducts.php b/plugins/woocommerce-admin/src/Notes/LearnMoreAboutVariableProducts.php deleted file mode 100644 index 950f95dfde1..00000000000 --- a/plugins/woocommerce-admin/src/Notes/LearnMoreAboutVariableProducts.php +++ /dev/null @@ -1,83 +0,0 @@ -post_type ) { - $product = wc_get_product( $post->ID ); - if ( ! $product ) { - return; - } - - $product->is_type( 'simple' ) && static::possibly_add_note(); - } - } - - /** - * Get the note. - * - * @return Note|null - */ - public static function get_note() { - $note = new Note(); - $note->set_title( __( 'Learn more about variable products', 'woocommerce-admin' ) ); - $note->set_content( - __( - 'Variable products are a powerful product type that lets you offer a set of variations on a product, with control over prices, stock, image and more for each variation. They can be used for a product like a shirt, where you can offer a large, medium and small and in different colors.', - 'woocommerce-admin' - ) - ); - $note->set_content_data( (object) array() ); - $note->set_type( 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/variable-product/?utm_source=inbox&utm_medium=product' - ); - - return $note; - } -} diff --git a/plugins/woocommerce-admin/src/Notes/Marketing.php b/plugins/woocommerce-admin/src/Notes/Marketing.php deleted file mode 100644 index 9aeb332643e..00000000000 --- a/plugins/woocommerce-admin/src/Notes/Marketing.php +++ /dev/null @@ -1,53 +0,0 @@ -set_title( __( 'Connect with your audience', 'woocommerce-admin' ) ); - $note->set_content( __( 'Grow your customer base and increase your sales with marketing tools built for WooCommerce.', 'woocommerce-admin' ) ); - $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); - $note->set_name( self::NOTE_NAME ); - $note->set_content_data( (object) array() ); - $note->set_source( 'woocommerce-admin' ); - $note->add_action( - 'open-marketing-hub', - __( 'Open marketing hub', 'woocommerce-admin' ), - admin_url( 'admin.php?page=wc-admin&path=/marketing' ), - Note::E_WC_ADMIN_NOTE_ACTIONED - ); - return $note; - } -} diff --git a/plugins/woocommerce-admin/src/Notes/NavigationFeedback.php b/plugins/woocommerce-admin/src/Notes/NavigationFeedback.php deleted file mode 100644 index 9a85392c710..00000000000 --- a/plugins/woocommerce-admin/src/Notes/NavigationFeedback.php +++ /dev/null @@ -1,56 +0,0 @@ -set_title( __( 'You now have access to the new WooCommerce navigation', 'woocommerce-admin' ) ); - $note->set_content( $content ); - $note->set_content_data( (object) array() ); - $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); - $note->set_name( self::NOTE_NAME ); - $note->set_source( 'woocommerce-admin' ); - $note->add_action( 'share-feedback', __( 'Share feedback', 'woocommerce-admin' ), Survey::get_url( '/new-navigation' ) ); - return $note; - } -} diff --git a/plugins/woocommerce-admin/src/Notes/NavigationFeedbackFollowUp.php b/plugins/woocommerce-admin/src/Notes/NavigationFeedbackFollowUp.php deleted file mode 100644 index e0be7fb7eb3..00000000000 --- a/plugins/woocommerce-admin/src/Notes/NavigationFeedbackFollowUp.php +++ /dev/null @@ -1,70 +0,0 @@ -get_notes_with_name( 'wc-admin-navigation-feedback' ); - if ( empty( $note_ids ) ) { - return; - } - - // Check that first note is at least 5 days old. - $note = Notes::get_note( $note_ids[0] ); - $timestamp = strtotime( $note->get_date_created() ); - if ( ( time() - $timestamp ) < DAY_IN_SECONDS * 5 ) { - return; - } - - $content = __( "We recently introduced the new navigation for a more intuitive and improved user experience. Now that you've had some time to give it a try, let us know how this will impact your store.", 'woocommerce-admin' ); - - $note = new Note(); - $note->set_title( __( 'Share your thoughts on the new WooCommerce navigation', 'woocommerce-admin' ) ); - $note->set_content( $content ); - $note->set_content_data( (object) array() ); - $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); - $note->set_name( self::NOTE_NAME ); - $note->set_source( 'woocommerce-admin' ); - $note->add_action( 'share-feedback', __( 'Share feedback', 'woocommerce-admin' ), Survey::get_url( '/new-navigation' ) ); - return $note; - } -} diff --git a/plugins/woocommerce-admin/src/Notes/NeedSomeInspiration.php b/plugins/woocommerce-admin/src/Notes/NeedSomeInspiration.php deleted file mode 100644 index 9f651e48444..00000000000 --- a/plugins/woocommerce-admin/src/Notes/NeedSomeInspiration.php +++ /dev/null @@ -1,68 +0,0 @@ -set_title( __( 'Browse our success stories', 'woocommerce-admin' ) ); - $note->set_content( __( 'Learn more about how other entrepreneurs used WooCommerce to build successful businesses.', 'woocommerce-admin' ) ); - $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); - $note->set_name( self::NOTE_NAME ); - $note->set_content_data( (object) array() ); - $note->set_source( 'woocommerce-admin' ); - $note->add_action( - 'need-some-inspiration', - __( 'See success stories', 'woocommerce-admin' ), - 'https://woocommerce.com/success-stories/?utm_source=inbox&utm_medium=product', - true - ); - return $note; - } -} diff --git a/plugins/woocommerce-admin/src/Notes/StartDropshippingBusiness.php b/plugins/woocommerce-admin/src/Notes/StartDropshippingBusiness.php deleted file mode 100644 index eeb8c5fa8c9..00000000000 --- a/plugins/woocommerce-admin/src/Notes/StartDropshippingBusiness.php +++ /dev/null @@ -1,82 +0,0 @@ -set_title( __( 'Are you considering starting a dropshipping business?', 'woocommerce-admin' ) ); - $note->set_content( __( 'The ability to add inventory without having to deal with production, stocking, or fulfilling orders may seem like a dream. But is dropshipping worth it? Let’s explore some of the advantages and disadvantages to help you make the best decision for your business.', 'woocommerce-admin' ) ); - $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); - $note->set_name( self::NOTE_NAME ); - $note->set_content_data( (object) array() ); - $note->set_source( 'woocommerce-admin' ); - $note->add_action( - 'dropshipping-business', - __( 'Learn more', 'woocommerce-admin' ), - 'https://woocommerce.com/posts/is-dropshipping-worth-it-pros-cons/?utm_source=inbox&utm_medium=product', - Note::E_WC_ADMIN_NOTE_ACTIONED, - true - ); - return $note; - } -} diff --git a/plugins/woocommerce-admin/tests/notes/class-wc-marketing.php b/plugins/woocommerce-admin/tests/notes/class-wc-marketing.php deleted file mode 100644 index ab101580dac..00000000000 --- a/plugins/woocommerce-admin/tests/notes/class-wc-marketing.php +++ /dev/null @@ -1,54 +0,0 @@ -instance = new Marketing(); - } - - /** - * Given wc_admin is <= 5 days old - * When get_note() is called - * Then it should return null - */ - public function test_it_does_not_add_note_unless_5_days_old() { - update_option( 'woocommerce_admin_install_timestamp', time() ); - - $note = $this->instance->get_note(); - $this->assertNull( $note ); - } - - /** - * Given wc_admin is >= 5 days old - * When get_note() is called - * Then it should not return null - */ - public function test_it_does_add_note_when_5_days_old() { - $five_days_ago = time() - 5 * 86400; - update_option( 'woocommerce_admin_install_timestamp', $five_days_ago ); - - $note = $this->instance->get_note(); - $this->assertNotNull( $note ); - } -} diff --git a/plugins/woocommerce-admin/tests/notes/class-wc-tests-learn-more-about-variable-product.php b/plugins/woocommerce-admin/tests/notes/class-wc-tests-learn-more-about-variable-product.php deleted file mode 100644 index 9f31d3b4633..00000000000 --- a/plugins/woocommerce-admin/tests/notes/class-wc-tests-learn-more-about-variable-product.php +++ /dev/null @@ -1,169 +0,0 @@ -query( "delete from {$wpdb->prefix}wc_admin_notes" ); - } - - /** - * Tests LearnMoreAboutVariableProducts gets created when a products gets published - */ - public function test_adding_note_when_product_gets_published() { - // Given a new product. - $product = array( - 'post_title' => 'a product', - 'post_type' => 'product', - 'post_status' => 'publish', - 'post_content' => '', - ); - - // When it is published. - wp_insert_post( $product ); - - // Then we should have LearnMoreAboutVariableProducts note. - $data_store = Notes::load_data_store(); - $note_ids = $data_store->get_notes_with_name( LearnMoreAboutVariableProducts::NOTE_NAME ); - $this->assertNotEmpty( $note_ids ); - $this->assertCount( 1, $note_ids ); - - $note = Notes::get_note( $note_ids[0] ); - $this->assertEquals( $note->get_name(), LearnMoreAboutVariableProducts::NOTE_NAME ); - - // Adding a second product does not create an additional note. - wp_insert_post( $product ); - $note_ids = $data_store->get_notes_with_name( LearnMoreAboutVariableProducts::NOTE_NAME ); - $this->assertNotEmpty( $note_ids ); - $this->assertCount( 1, $note_ids ); - } - - /** - * Test a variable product does not create LearnMoreAboutVariableProducts note - */ - public function test_adding_variable_product_does_not_add_note() { - // Given a variable product. - $product = $this->create_variable_product(); - - // When it gets published. - wp_publish_post( $product->get_id() ); - - // Then a note should not be added. - $note_ids = $this->get_note_ids(); - $note_count = count( $note_ids ); - $this->assertEmpty( $note_ids, "{$note_count} notes found." ); - } - - - /** - * @dataProvider postProvider - * - * @param string $product product from provider. - */ - public function test_adding_draft_product_and_non_product_post_does_not_add_note( $product ) { - wp_insert_post( $product ); - - $note_ids = $this->get_note_ids(); - $note_count = count( $note_ids ); - $this->assertEmpty( $note_ids, "{$note_count} notes found." ); - } - - /** - * Post provider for draft product and non-product post type - * - * @return array a set of posts. - */ - public function postProvider() { - return array( - array( - 'post_title' => 'a product', - 'post_type' => 'not a product', - 'post_status' => 'publish', - 'post_content' => '', - ), - array( - 'post_title' => 'a product', - 'post_type' => 'product', - 'post_status' => 'draft', - 'post_content' => '', - ), - ); - } - - /** - * Return note ids - * @return array - */ - protected function get_note_ids() { - $data_store = Notes::load_data_store(); - return $data_store->get_notes_with_name( LearnMoreAboutVariableProducts::NOTE_NAME ); - } - - /** - * Create a variable product for testing - * - * @return WC_Product_Variable - */ - protected function create_variable_product() { - $name = 'test'; - $product = new \WC_Product_Variable(); - $attribute = new \WC_Product_Attribute(); - $attribute->set_id( 0 ); - $attribute->set_name( wp_rand( 1, 100 ) ); - $attribute->set_options( array_filter( array( 1, 2 ) ) ); - $attributes[] = $attribute; - - $product->set_props( - array( - 'name' => $name, - 'featured' => wp_rand( 1, 10 ), - 'attributes' => $attributes, - 'status' => 'draft', - ) - ); - // Need to save to get an ID for variations. - $product->save(); - - // Create variations, one for each attribute value combination. - $variation_attributes = wc_list_pluck( - array_filter( - $product->get_attributes(), - 'wc_attributes_array_filter_variation' - ), - 'get_slugs' - ); - $possible_attributes = array_reverse( wc_array_cartesian( $variation_attributes ) ); - foreach ( $possible_attributes as $possible_attribute ) { - $variation = new \WC_Product_Variation(); - $variation->set_props( - array( - 'parent_id' => $product->get_id(), - 'attributes' => $possible_attribute, - 'regular_price' => 10, - 'stock_status' => 'instock', - ) - ); - $variation->save(); - } - $data_store = $product->get_data_store(); - $data_store->sort_all_product_variations( $product->get_id() ); - - return $product; - } -}