WOOT - WooCommerce Active Products Tables

How to create custom column for meta field

Use tab “Meta” in the table tools popup.

Also you can add it by code. Use next code in file functions.php:

add_action('woot_profile_extend', function($profile, $action_name) {

    $profile['hmeta_1'] = [
        'title' => WOOT_Vocabulary::get('Meta 1'),
        'order' => 'asc',
        'display' => false, //display in fields list in the settings
        'action' => function($post_id) {
            return get_post_meta($post_id, 'meta_1', true);
        }
    ];

    return $profile;
}, 10, 2);

Trough code you can use custom columns in such shortcodes as [woot_upsells]: [woot_upsells id=49 columns=’id,title,price,hmeta_1,cart’]


Also for some tables it is possible to modificate results in the table cell:

add_action('woot_meta_data_cell', function($value, $meta_data, $post_id, $table_id) {

    if ($meta_data['meta_key'] === 'meta_1' AND $table_id === 21) {
        $value = floatval($value) * floatval(get_post_meta($post_id, 'meta_2', true));
    }

    return $value;
}, 10, 4);

This code for table 21 in meta cell meta_1 will display results of a math operation.