Automattic\WooCommerce\Internal\Admin

Homescreen::component_settings()publicWC 1.0

Add data to the shared component settings.

{} Это метод класса: Homescreen{}

Хуков нет.

Возвращает

null. Ничего.

Использование

$Homescreen = new Homescreen();
$Homescreen->component_settings( $settings );
$settings(массив) (обязательный)
Shared component settings.

Код Homescreen::component_settings() WC 6.4.1

public function component_settings( $settings ) {
	$allowed_statuses = Loader::get_order_statuses( wc_get_order_statuses() );

	// Remove the Draft Order status (from the Checkout Block).
	unset( $allowed_statuses['checkout-draft'] );

	$status_counts                     = array_map( 'wc_orders_count', array_keys( $allowed_statuses ) );
	$product_counts                    = wp_count_posts( 'product' );
	$settings['orderCount']            = array_sum( $status_counts );
	$settings['publishedProductCount'] = $product_counts->publish;

	return $settings;
}