WOOT - WooCommerce Active Products Tables

How to add meta key globally to all shortcodes

Use hook woot_profile_extend.

Example: add next code to file functions.php of the current wordpress theme

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

    if ($action_name === 'woot_woocommerce_tables') {

        $meta_key = 'my_global_column';//important!

        $meta_data = [
            'title' => WOOT_Vocabulary::get('My meta column'),
            'meta_key' => $meta_key,
            'meta_type' => 'text', //text, number, calendar
        ];


        $profile[$meta_key] = woot()->columns->meta->assemble_meta_for_system($meta_data);
    }

    return $profile;
}, 10, 2);

In code replace your meta key in variable $meta_key and change column title (My meta column).

Make your attention on metadata types:

  • text
  • number
  • calendar