/var/www/html_uk/wp-content/plugins/automatewoo/includes/Fields_Helper.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
<?php
// phpcs:ignoreFile

namespace AutomateWoo;

/**
 * @class Fields_Helper
 */
class Fields_Helper {

    
/**
     * @return array
     */
    
static function get_categories_list() {
        
$list = [];

        
$categories get_terms'product_cat', [
            
'orderby' => 'name',
            
'hide_empty' => false
        
]);

        foreach ( 
$categories as $category ) {
            
$list$category->term_id ] = $category->name;
        }

        return 
$list;
    }


    
/**
     * @since 3.2.8
     * @return array
     */
    
static function get_product_tags_list() {
        
$list = [];

        
$terms get_terms'product_tag', [
            
'orderby' => 'name',
            
'hide_empty' => false
        
]);

        foreach ( 
$terms as $term ) {
            
$list$term->term_id ] = $term->name;
        }

        return 
$list;
    }

    
/**
     * @return array
     */
    
static function get_user_tags_list() {
        
$list = [];

        
$tags get_terms([
            
'taxonomy' => 'user_tag',
            
'hide_empty' => false
        
]);

        foreach ( 
$tags as $tag ) {
            
$list[$tag->term_id] = $tag->name;
        }

        return 
$list;
    }

}