Add WooCommerce Subscriptions note (https://github.com/woocommerce/woocommerce-admin/pull/4451)
* Add WooCommerce Subscriptions note * Update note type to marketing
This commit is contained in:
parent
7a62d36516
commit
9149b0cce6
|
@ -20,6 +20,7 @@ use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Personalize_Store;
|
||||||
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_EU_VAT_Number;
|
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_EU_VAT_Number;
|
||||||
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_WooCommerce_Payments;
|
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_WooCommerce_Payments;
|
||||||
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Marketing;
|
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Marketing;
|
||||||
|
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_WooCommerce_Subscriptions;
|
||||||
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Migrate_From_Shopify;
|
use \Automattic\WooCommerce\Admin\Notes\WC_Admin_Notes_Migrate_From_Shopify;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -75,6 +76,7 @@ class Events {
|
||||||
WC_Admin_Notes_EU_VAT_Number::possibly_add_note();
|
WC_Admin_Notes_EU_VAT_Number::possibly_add_note();
|
||||||
WC_Admin_Notes_Marketing::possibly_add_note();
|
WC_Admin_Notes_Marketing::possibly_add_note();
|
||||||
WC_Admin_Notes_Giving_Feedback_Notes::possibly_add_note();
|
WC_Admin_Notes_Giving_Feedback_Notes::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();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,61 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* WooCommerce Admin: WooCommerce Subscriptions.
|
||||||
|
*
|
||||||
|
* Adds a note to learn more about WooCommerce Subscriptions.
|
||||||
|
*
|
||||||
|
* @package WooCommerce Admin
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace Automattic\WooCommerce\Admin\Notes;
|
||||||
|
|
||||||
|
defined( 'ABSPATH' ) || exit;
|
||||||
|
|
||||||
|
use \Automattic\WooCommerce\Admin\Features\Onboarding;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* WC_Admin_Notes_WooCommerce_Subscriptions.
|
||||||
|
*/
|
||||||
|
class WC_Admin_Notes_WooCommerce_Subscriptions {
|
||||||
|
/**
|
||||||
|
* Note traits.
|
||||||
|
*/
|
||||||
|
use NoteTraits;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Name of the note for use in the database.
|
||||||
|
*/
|
||||||
|
const NOTE_NAME = 'wc-admin-woocommerce-subscriptions';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the note.
|
||||||
|
*/
|
||||||
|
public static function get_note() {
|
||||||
|
$onboarding_data = get_option( Onboarding::PROFILE_DATA_OPTION, array() );
|
||||||
|
|
||||||
|
if ( ! isset( $onboarding_data['product_types'] ) || ! in_array( 'subscriptions', $onboarding_data['product_types'], true ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( ! self::wc_admin_active_for( DAY_IN_SECONDS ) ) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$note = new WC_Admin_Note();
|
||||||
|
$note->set_title( __( 'Do you need more info about WooCommerce Subscriptions?', 'woocommerce-admin' ) );
|
||||||
|
$note->set_content( __( 'WooCommerce Subscriptions allows you to introduce a variety of subscriptions for physical or virtual products and services. Create product-of-the-month clubs, weekly service subscriptions or even yearly software billing packages. Add sign-up fees, offer free trials, or set expiration periods.', 'woocommerce-admin' ) );
|
||||||
|
$note->set_type( WC_Admin_Note::E_WC_ADMIN_NOTE_MARKETING );
|
||||||
|
$note->set_icon( 'info' );
|
||||||
|
$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://woocommerce.com/products/woocommerce-subscriptions/?utm_source=inbox',
|
||||||
|
'actioned',
|
||||||
|
true
|
||||||
|
);
|
||||||
|
return $note;
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue