Add Need some inspiration admin note (https://github.com/woocommerce/woocommerce-admin/pull/4509)
* Add Need some inspiration admin note * Fix action URL Co-authored-by: Rebecca Scott <me@becdetat.com>
This commit is contained in:
parent
07222c08ff
commit
2579eb28c3
|
@ -28,6 +28,7 @@ use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Real_Time_Order_Alerts;
|
||||||
use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\DataSourcePoller;
|
use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\DataSourcePoller;
|
||||||
use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\RemoteInboxNotificationsEngine;
|
use \Automattic\WooCommerce\Admin\RemoteInboxNotifications\RemoteInboxNotificationsEngine;
|
||||||
use \Automattic\WooCommerce\Admin\Loader;
|
use \Automattic\WooCommerce\Admin\Loader;
|
||||||
|
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Need_Some_Inspiration;
|
||||||
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Learn_More_About_Product_Settings;
|
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Learn_More_About_Product_Settings;
|
||||||
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Online_Clothing_Store;
|
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Online_Clothing_Store;
|
||||||
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_First_Product;
|
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_First_Product;
|
||||||
|
@ -88,6 +89,7 @@ class Events {
|
||||||
WC_Admin_Notes_Start_Dropshipping_Business::possibly_add_note();
|
WC_Admin_Notes_Start_Dropshipping_Business::possibly_add_note();
|
||||||
WC_Admin_Notes_WooCommerce_Subscriptions::possibly_add_note();
|
WC_Admin_Notes_WooCommerce_Subscriptions::possibly_add_note();
|
||||||
WC_Admin_Notes_Migrate_From_Shopify::possibly_add_note();
|
WC_Admin_Notes_Migrate_From_Shopify::possibly_add_note();
|
||||||
|
WC_Admin_Notes_Need_Some_Inspiration::possibly_add_note();
|
||||||
WC_Admin_Notes_Learn_More_About_Product_Settings::possibly_add_note();
|
WC_Admin_Notes_Learn_More_About_Product_Settings::possibly_add_note();
|
||||||
WC_Admin_Notes_Online_Clothing_Store::possibly_add_note();
|
WC_Admin_Notes_Online_Clothing_Store::possibly_add_note();
|
||||||
WC_Admin_Notes_First_Product::possibly_add_note();
|
WC_Admin_Notes_First_Product::possibly_add_note();
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* WooCommerce Admin: Do you need some inspiration?
|
||||||
|
*
|
||||||
|
* Adds a note to ask the client if they need some inspiration.
|
||||||
|
*
|
||||||
|
* @package WooCommerce Admin
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Automattic\WooCommerce\Admin\Notes;
|
||||||
|
|
||||||
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WC_Admin_Notes_Need_Some_Inspiration.
|
||||||
|
*/
|
||||||
|
class WC_Admin_Notes_Need_Some_Inspiration {
|
||||||
|
/**
|
||||||
|
* Note traits.
|
||||||
|
*/
|
||||||
|
use NoteTraits;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the note for use in the database.
|
||||||
|
*/
|
||||||
|
const NOTE_NAME = 'wc-admin-need-some-inspiration';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the note.
|
||||||
|
*/
|
||||||
|
public static function get_note() {
|
||||||
|
// We want to show the note after five days.
|
||||||
|
if ( ! self::wc_admin_active_for( 5 * DAY_IN_SECONDS ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$onboarding_profile = get_option( 'woocommerce_onboarding_profile', array() );
|
||||||
|
|
||||||
|
// Confirm that $onboarding_profile is set.
|
||||||
|
if ( empty( $onboarding_profile ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Make sure that the person who filled out the OBW was not setting up
|
||||||
|
// the store for their customer/client.
|
||||||
|
if ( $onboarding_profile['setup_client'] ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$note = new WC_Admin_Note();
|
||||||
|
$note->set_title( __( 'Do you need some inspiration?', 'woocommerce-admin' ) );
|
||||||
|
$note->set_content( __( 'Check some of our favorite customer stories from entrepreneurs, agencies, and developers in our global community.', 'woocommerce-admin' ) );
|
||||||
|
$note->set_type( WC_Admin_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',
|
||||||
|
WC_Admin_Note::E_WC_ADMIN_NOTE_ACTIONED,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
return $note;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue