WOOT - WooCommerce Active Products Tables

woot_wp_query_args

This hook allows to manipulate by main WP_Query of the table data.


Some examples:

 add_filter('woot_wp_query_args', function($args, $table_id) {
            if ($table_id > 0 AND woot()->columns->options->get($table_id, 'hide_in_cart_added', 0)) {
                $args['post__not_in'] = $this->get_ids_in_cart();
            }
            return $args;
        }, 10, 2);

 

add_action('woot_wp_query_args', function($args, $table_id) {
    $product_ids_on_sale = wc_get_product_ids_on_sale();

    if (!empty($product_ids_on_sale)) {
        $args['post__in'] = $product_ids_on_sale;
    }

    return $args;
}, 10, 2);

 

add_action('woot_wp_query_args', function($args, $table_id) {

    if (!isset($args['meta_query'])) {
        $args['meta_query'] = [];
    }

    $args['meta_query'][] = array(
        'key' => '_stock_status',
        'value' => 'instock',
        'compare' => 'IN'
    );

    return $args;
}, 10, 2);