/var/www/html/wp-content/plugins/woocommerce/src/Internal/Admin/Onboarding/OnboardingIndustries.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
<?php
/**
 * WooCommerce Onboarding Industries
 */

namespace Automattic\WooCommerce\Internal\Admin\Onboarding;

/**
 * Logic around onboarding industries.
 */
class OnboardingIndustries {
    
/**
     * Init.
     */
    
public static function init() {
        
add_filter'woocommerce_admin_onboarding_preloaded_data', array( __CLASS__'preload_data' ) );
    }

    
/**
     * Get a list of allowed industries for the onboarding wizard.
     *
     * @return array
     */
    
public static function get_allowed_industries() {
        
/* With "use_description" we turn the description input on. With "description_label" we set the input label */
        
return apply_filters(
            
'woocommerce_admin_onboarding_industries',
            array(
                
'fashion-apparel-accessories'     => array(
                    
'label'             => __'Fashion, apparel, and accessories''woocommerce' ),
                    
'use_description'   => false,
                    
'description_label' => '',
                ),
                
'health-beauty'                   => array(
                    
'label'             => __'Health and beauty''woocommerce' ),
                    
'use_description'   => false,
                    
'description_label' => '',
                ),
                
'electronics-computers'           => array(
                    
'label'             => __'Electronics and computers''woocommerce' ),
                    
'use_description'   => false,
                    
'description_label' => '',
                ),
                
'food-drink'                      => array(
                    
'label'             => __'Food and drink''woocommerce' ),
                    
'use_description'   => false,
                    
'description_label' => '',
                ),
                
'home-furniture-garden'           => array(
                    
'label'             => __'Home, furniture, and garden''woocommerce' ),
                    
'use_description'   => false,
                    
'description_label' => '',
                ),
                
'cbd-other-hemp-derived-products' => array(
                    
'label'             => __'CBD and other hemp-derived products''woocommerce' ),
                    
'use_description'   => false,
                    
'description_label' => '',
                ),
                
'education-and-learning'          => array(
                    
'label'             => __'Education and learning''woocommerce' ),
                    
'use_description'   => false,
                    
'description_label' => '',
                ),
                
'sports-and-recreation'           => array(
                    
'label'             => __'Sports and recreation''woocommerce' ),
                    
'use_description'   => false,
                    
'description_label' => '',
                ),
                
'arts-and-crafts'                 => array(
                    
'label'             => __'Arts and crafts''woocommerce' ),
                    
'use_description'   => false,
                    
'description_label' => '',
                ),
                
'other'                           => array(
                    
'label'             => __'Other''woocommerce' ),
                    
'use_description'   => true,
                    
'description_label' => __'Description''woocommerce' ),
                ),
            )
        );
    }

    
/**
     * Add preloaded data to onboarding.
     *
     * @param array $settings Component settings.
     * @return array
     */
    
public static function preload_data$settings ) {
        
$settings['onboarding']['industries'] = self::get_allowed_industries();
        return 
$settings;
    }
}