Automattic\WooCommerce\Blocks\SharedStores

ProductsStore::register_stateprivate staticWC 1.0

Register the interactivity state if products have been loaded.

Method of the class: ProductsStore{}

No Hooks.

Returns

null. Nothing (null).

Usage

$result = ProductsStore::register_state(): void;

ProductsStore::register_state() code WC 10.7.0

private static function register_state(): void {
	$state = array();

	if ( ! empty( self::$products ) ) {
		$state['products'] = self::$products;
	}

	if ( ! empty( self::$product_variations ) ) {
		$state['productVariations'] = self::$product_variations;
	}

	if ( ! empty( $state ) ) {
		wp_interactivity_state( self::$store_namespace, $state );
	}
}