WOOT - WooCommerce Active Products Tables

Show different tables to users selected by user roles

You can wrap some shortcodes into your custom one. Do next:

  • open file functions.php of the current WordPress theme
  • paste and edit there next code:
    add_shortcode('my_woot_1', function($args) {
        $user = wp_get_current_user();
    
        if (in_array('administrator', $user->roles)) {
            return do_shortcode('[woot id=23]');
        } elseif (in_array('shop_manager', $user->roles)) {
            return do_shortcode('[woot id=29]');
        } else {
            return do_shortcode('[woot columns="id,title,price,pa_color,add_to_cart"]');
        }
    });
  • paste shortcode [my_woot_1] to page you want
  • also make your attention to $args – you can make custom shortcode attributes

On this way you can create different custom shortcodes for your woocommerce shop!