WC_Install::should_enable_hpos_for_new_shop
Checks whether HPOS should be enabled for new shops.
Method of the class: WC_Install{}
Hooks from the method
Returns
true|false.
Usage
$result = WC_Install::should_enable_hpos_for_new_shop();
WC_Install::should_enable_hpos_for_new_shop() WC Install::should enable hpos for new shop code WC 10.3.3
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 );
}