CustomizeStoreWithBlocks.php
2 years ago
CustomizingProductCatalog.php
1 year ago
EUVATNumber.php
2 years ago
EditProductsOnTheMove.php
2 years ago
EmailImprovements.php
1 year ago
FirstProduct.php
1 year ago
GivingFeedbackNotes.php
3 years ago
InstallJPAndWCSPlugins.php
4 weeks ago
LaunchChecklist.php
2 years ago
MagentoMigration.php
2 years ago
ManageOrdersOnTheGo.php
2 years ago
MarketingJetpack.php
4 weeks ago
MigrateFromShopify.php
2 years ago
MobileApp.php
2 years ago
NewSalesRecord.php
3 years ago
NoteActionForbiddenException.php
4 weeks ago
OnboardingPayments.php
2 years ago
OnlineClothingStore.php
2 years ago
OrderMilestones.php
2 years ago
PaymentsMoreInfoNeeded.php
5 months ago
PaymentsRemindMeLater.php
5 months ago
PerformanceOnMobile.php
2 years ago
PersonalizeStore.php
3 years ago
RealTimeOrderAlerts.php
2 years ago
ScheduledUpdatesPromotion.php
5 months ago
SellingOnlineCourses.php
2 years ago
TrackingOptIn.php
1 year ago
UnsecuredReportFiles.php
2 years ago
WooCommercePayments.php
2 years ago
WooCommerceSubscriptions.php
2 years ago
WooSubscriptionsNotes.php
1 year ago
PersonalizeStore.php
64 lines
| 1 | <?php |
| 2 | /** |
| 3 | * WooCommerce Admin Personalize Your Store Note Provider. |
| 4 | * |
| 5 | * Adds a note to the merchant's inbox prompting them to personalize their store. |
| 6 | */ |
| 7 | |
| 8 | namespace Automattic\WooCommerce\Internal\Admin\Notes; |
| 9 | |
| 10 | defined( 'ABSPATH' ) || exit; |
| 11 | |
| 12 | use Automattic\WooCommerce\Admin\Notes\Note; |
| 13 | use Automattic\WooCommerce\Admin\Notes\NoteTraits; |
| 14 | |
| 15 | /** |
| 16 | * Personalize_Store |
| 17 | */ |
| 18 | class PersonalizeStore { |
| 19 | /** |
| 20 | * Note traits. |
| 21 | */ |
| 22 | use NoteTraits; |
| 23 | |
| 24 | /** |
| 25 | * Name of the note for use in the database. |
| 26 | */ |
| 27 | const NOTE_NAME = 'wc-admin-personalize-store'; |
| 28 | |
| 29 | /** |
| 30 | * Get the note. |
| 31 | * |
| 32 | * @return Note |
| 33 | */ |
| 34 | public static function get_note() { |
| 35 | // Only show the note to stores with homepage. |
| 36 | $homepage_id = get_option( 'woocommerce_onboarding_homepage_post_id', false ); |
| 37 | if ( ! $homepage_id ) { |
| 38 | return; |
| 39 | } |
| 40 | |
| 41 | // Show the note after task list is done. |
| 42 | $is_task_list_complete = get_option( 'woocommerce_task_list_complete', false ); |
| 43 | |
| 44 | // We want to show the note after day 5. |
| 45 | $five_days_in_seconds = 5 * DAY_IN_SECONDS; |
| 46 | |
| 47 | if ( ! self::is_wc_admin_active_in_date_range( 'week-1-4', $five_days_in_seconds ) && ! $is_task_list_complete ) { |
| 48 | return; |
| 49 | } |
| 50 | |
| 51 | $content = __( 'The homepage is one of the most important entry points in your store. When done right it can lead to higher conversions and engagement. Don\'t forget to personalize the homepage that we created for your store during the onboarding.', 'woocommerce' ); |
| 52 | |
| 53 | $note = new Note(); |
| 54 | $note->set_title( __( 'Personalize your store\'s homepage', 'woocommerce' ) ); |
| 55 | $note->set_content( $content ); |
| 56 | $note->set_content_data( (object) array() ); |
| 57 | $note->set_type( Note::E_WC_ADMIN_NOTE_INFORMATIONAL ); |
| 58 | $note->set_name( self::NOTE_NAME ); |
| 59 | $note->set_source( 'woocommerce-admin' ); |
| 60 | $note->add_action( 'personalize-homepage', __( 'Personalize homepage', 'woocommerce' ), admin_url( 'post.php?post=' . $homepage_id . '&action=edit' ), Note::E_WC_ADMIN_NOTE_ACTIONED ); |
| 61 | return $note; |
| 62 | } |
| 63 | } |
| 64 |