[WC Tracker]: Track brands count (#52056)
* [WC Tracker]: Track brands count * Add changefile(s) from automation for the following project(s): woocommerce * Handle case where the product_brand taxonomy doesn't exist. --------- Co-authored-by: github-actions <github-actions@github.com>
This commit is contained in:
parent
dc8fdcfb9a
commit
24403c244e
|
@ -0,0 +1,4 @@
|
||||||
|
Significance: minor
|
||||||
|
Type: add
|
||||||
|
|
||||||
|
Added tracking for number of brands.
|
|
@ -179,6 +179,7 @@ class WC_Tracker {
|
||||||
$data['orders'] = self::get_orders();
|
$data['orders'] = self::get_orders();
|
||||||
$data['reviews'] = self::get_review_counts();
|
$data['reviews'] = self::get_review_counts();
|
||||||
$data['categories'] = self::get_category_counts();
|
$data['categories'] = self::get_category_counts();
|
||||||
|
$data['brands'] = self::get_brands_counts();
|
||||||
|
|
||||||
// Payment gateway info.
|
// Payment gateway info.
|
||||||
$data['gateways'] = self::get_active_payment_gateways();
|
$data['gateways'] = self::get_active_payment_gateways();
|
||||||
|
@ -882,6 +883,18 @@ class WC_Tracker {
|
||||||
return wp_count_terms( 'product_cat' );
|
return wp_count_terms( 'product_cat' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the number of product brands.
|
||||||
|
*
|
||||||
|
* @return int
|
||||||
|
*/
|
||||||
|
private static function get_brands_counts() {
|
||||||
|
if ( ! taxonomy_exists( 'product_brand' ) ) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return wp_count_terms( 'product_brand' );
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get a list of all active payment gateways.
|
* Get a list of all active payment gateways.
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue