WordPress at a glance
function is not described


Homescreen::component_settings() public WC 1.0

Add data to the shared component settings.

{} It's a method of the class: Homescreen{}

No Hooks.


null. Nothing.


$Homescreen = new Homescreen();
$Homescreen->component_settings( $settings );
$settings(array) (required)
Shared component settings.

Code of Homescreen::component_settings() WC 5.3.0

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;