WooCommerce Code Reference

FilteredGetDataTrait

Trait to call filters on `get_data` methods for data stores.

It calls the filters woocommerce_analytics_{$this->context}_query_args and woocommerce_analytics_{$this->context}_select_query on the get_data method.

Example:

class MyStatsDataStore extends DataStore implements DataStoreInterface {
    // Use the trait.
    use FilteredGetDataTrait;
    // Provide all the necessary properties and methods for a regular DataStore.
    // ...
}
Tags
see
DataStore

Table of Contents

get_data()  : stdClass|WP_Error
Get the data based on args.

Methods

get_data()

Get the data based on args.

public get_data(array<string|int, mixed> $query_args) : stdClass|WP_Error

Filters query args, calls DataStore::get_data, and returns the filtered data.

Parameters
$query_args : array<string|int, mixed>

Query parameters.

Tags
override

ReportsDataStore::get_data()

Return values
stdClass|WP_Error