/var/www/html_us/wp-content/plugins/woocommerce/src/Internal/Admin/Notes/PersonalizeStore.php


1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
<?php
/**
 * WooCommerce Admin Personalize Your Store Note Provider.
 *
 * Adds a note to the merchant's inbox prompting them to personalize their store.
 */

namespace Automattic\WooCommerce\Internal\Admin\Notes;

defined'ABSPATH' ) || exit;

use 
Automattic\WooCommerce\Admin\Notes\Note;
use 
Automattic\WooCommerce\Admin\Notes\NoteTraits;

/**
 * Personalize_Store
 */
class PersonalizeStore {
    
/**
     * Note traits.
     */
    
use NoteTraits;

    
/**
     * Name of the note for use in the database.
     */
    
const NOTE_NAME 'wc-admin-personalize-store';

    
/**
     * Get the note.
     *
     * @return Note
     */
    
public static function get_note() {
        
// Only show the note to stores with homepage.
        
$homepage_id get_option'woocommerce_onboarding_homepage_post_id'false );
        if ( ! 
$homepage_id ) {
            return;
        }

        
// Show the note after task list is done.
        
$is_task_list_complete get_option'woocommerce_task_list_complete'false );

        
// We want to show the note after day 5.
        
$five_days_in_seconds DAY_IN_SECONDS;

        if ( ! 
self::is_wc_admin_active_in_date_range'week-1-4'$five_days_in_seconds ) && ! $is_task_list_complete ) {
            return;
        }

        
$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' );

        
$note = new Note();
        
$note->set_title__'Personalize your store\'s homepage''woocommerce' ) );
        
$note->set_content$content );
        
$note->set_content_data( (object) array() );
        
$note->set_typeNote::E_WC_ADMIN_NOTE_INFORMATIONAL );
        
$note->set_nameself::NOTE_NAME );
        
$note->set_source'woocommerce-admin' );
        
$note->add_action'personalize-homepage'__'Personalize homepage''woocommerce' ), admin_url'post.php?post=' $homepage_id '&action=edit' ), Note::E_WC_ADMIN_NOTE_ACTIONED );
        return 
$note;
    }
}