WC_Install::should_enable_hpos_for_new_shop()private staticWC 1.0

Checks whether HPOS should be enabled for new shops.

Method of the class: WC_Install{}

Return

true|false.

Usage

$result = WC_Install::should_enable_hpos_for_new_shop();

WC_Install::should_enable_hpos_for_new_shop() code WC 9.4.2

private static function should_enable_hpos_for_new_shop() {
	if ( ! did_action( 'woocommerce_init' ) && ! doing_action( 'woocommerce_init' ) ) {
		return false;
	}

	$feature_controller = wc_get_container()->get( FeaturesController::class );

	if ( OrderUtil::custom_orders_table_usage_is_enabled() ) {
		return true;
	}

	if ( ! empty( wc_get_orders( array( 'limit' => 1 ) ) ) ) {
		return false;
	}

	$plugin_compat_info = $feature_controller->get_compatible_plugins_for_feature( 'custom_order_tables', true );
	if ( ! empty( $plugin_compat_info['incompatible'] ) || ! empty( $plugin_compat_info['uncertain'] ) ) {
		return false;
	}

	/**
	 * Filter to enable HPOS by default for new shops.
	 *
	 * @since 8.2.0
	 */
	return apply_filters( 'woocommerce_enable_hpos_by_default_for_new_shops', true );
}