wp_script_is( 'selectWoo', 'done' ) || wp_script_is( 'selectWoo', 'enqueued' ) || wp_script_is( 'select2', 'done' ), 'checkout' => wp_script_is( 'wc-checkout', 'done' ) || wp_script_is( 'wc-checkout', 'enqueued' ), ); $old = get_option( self::RUNTIME, array() ); $old = is_array( $old ) ? $old : array(); unset( $old['time'] ); if ( $old !== $now || ! get_transient( self::RUNTIME . '_fresh' ) ) { $now['time'] = time(); update_option( self::RUNTIME, $now, false ); set_transient( self::RUNTIME . '_fresh', 1, DAY_IN_SECONDS ); } } /** * Every finding: [ id, status (ok|info|warning|error), title, text, link, link_text ]. * * @return array */ public static function checks(): array { static $checks = null; if ( null !== $checks ) { return $checks; } $checks = array(); $add = static function ( string $id, string $status, string $title, string $text = '', string $link = '', string $link_text = '' ) use ( &$checks ): void { $checks[] = array( 'id' => $id, 'status' => $status, 'title' => $title, 'text' => $text, 'link' => $link, 'link_text' => $link_text, ); }; self::versions( $add ); self::checkout_page( $add ); self::theme( $add ); self::overrides( $add ); self::runtime( $add ); self::scheduled( $add ); self::caches( $add ); self::shipping_bar( $add ); self::recovery( $add ); self::express( $add ); self::hpos( $add ); /** * Filters the health findings shown on the Tools tab. * * @since 1.6.0 * * @param array $checks Findings: id, status (ok, info, warning, error), title, text, link, link_text. */ $filtered = apply_filters( 'aiolos_health_checks', $checks ); $clean = array(); foreach ( is_array( $filtered ) ? $filtered : array() as $check ) { if ( ! is_array( $check ) || empty( $check['title'] ) || ! is_string( $check['title'] ) ) { continue; } $status = in_array( $check['status'] ?? '', array( 'ok', 'info', 'warning', 'error' ), true ) ? $check['status'] : 'info'; $clean[] = array( 'id' => sanitize_key( (string) ( $check['id'] ?? '' ) ), 'status' => $status, 'title' => (string) $check['title'], 'text' => is_string( $check['text'] ?? null ) ? $check['text'] : '', 'link' => is_string( $check['link'] ?? null ) ? $check['link'] : '', 'link_text' => is_string( $check['link_text'] ?? null ) ? $check['link_text'] : '', ); } // Problems first. $order = array( 'error' => 0, 'warning' => 1, 'info' => 2, 'ok' => 3, ); usort( $clean, static fn( $a, $b ) => $order[ $a['status'] ] <=> $order[ $b['status'] ] ); $checks = $clean; return $checks; } /** * How many findings need attention (warnings and errors). */ public static function problems(): int { return count( array_filter( self::checks(), static fn( $c ) => in_array( $c['status'], array( 'warning', 'error' ), true ) ) ); } /** * WordPress, WooCommerce and HTTPS. * * @param callable $add Adder. */ private static function versions( callable $add ): void { if ( defined( 'WC_VERSION' ) && version_compare( WC_VERSION, '8.5', '<' ) ) { $add( 'woocommerce', 'error', __( 'WooCommerce is too old', 'aiolos-checkout-for-woocommerce' ), /* translators: %s: version */ sprintf( __( 'Aiolos Checkout needs WooCommerce 8.5 or newer; this site has %s. Update WooCommerce.', 'aiolos-checkout-for-woocommerce' ), WC_VERSION ), admin_url( 'plugins.php' ), __( 'Plugins', 'aiolos-checkout-for-woocommerce' ) ); } if ( 0 !== strpos( (string) home_url(), 'https://' ) ) { $add( 'https', 'warning', __( 'The shop is not on HTTPS', 'aiolos-checkout-for-woocommerce' ), __( 'Card payments, Apple Pay and Google Pay need a secure (https://) address, and browsers mark forms without it as not secure. Ask your host for an SSL certificate.', 'aiolos-checkout-for-woocommerce' ) ); } } /** * The checkout page. * * @param callable $add Adder. */ private static function checkout_page( callable $add ): void { $page = function_exists( 'wc_get_page_id' ) ? (int) wc_get_page_id( 'checkout' ) : 0; if ( $page <= 0 || 'publish' !== get_post_status( $page ) ) { $add( 'checkout-page', 'error', __( 'No checkout page', 'aiolos-checkout-for-woocommerce' ), __( 'WooCommerce has no published checkout page, so there is nowhere to show the checkout. Choose one in WooCommerce > Settings > Advanced.', 'aiolos-checkout-for-woocommerce' ), admin_url( 'admin.php?page=wc-settings&tab=advanced' ), __( 'Page setup', 'aiolos-checkout-for-woocommerce' ) ); return; } $content = (string) get_post_field( 'post_content', $page ); if ( has_block( 'woocommerce/checkout', $content ) && ! has_shortcode( $content, 'woocommerce_checkout' ) ) { $switch = wp_nonce_url( admin_url( 'admin-post.php?action=aiolos_use_classic_checkout' ), 'aiolos_use_classic_checkout' ); $add( 'block-checkout', Settings::enabled( 'checkout_enabled' ) ? 'warning' : 'info', __( 'The checkout page is built with the Checkout block', 'aiolos-checkout-for-woocommerce' ), __( 'Payment plugins load differently for the block. Aiolos Checkout shows its own checkout anyway, but for every gateway to behave the page should hold the classic checkout shortcode (the block content is kept and can be restored).', 'aiolos-checkout-for-woocommerce' ), $switch, __( 'Switch to the shortcode', 'aiolos-checkout-for-woocommerce' ) ); } else { $add( 'checkout-page', 'ok', __( 'Checkout page', 'aiolos-checkout-for-woocommerce' ), __( 'The checkout page holds WooCommerce\'s classic checkout.', 'aiolos-checkout-for-woocommerce' ) ); } } /** * Themes that are known to get in the way, each with what to do. * * @param callable $add Adder. */ private static function theme( callable $add ): void { $theme = wp_get_theme(); $template = strtolower( (string) $theme->get_template() ); $found = false; if ( 'divi' === $template || 'extra' === $template || function_exists( 'et_setup_theme' ) ) { $found = true; $add( 'theme-divi', 'warning', __( 'Divi', 'aiolos-checkout-for-woocommerce' ), __( 'Divi\'s Theme Builder can replace the checkout page with its own layout, and its "Defer jQuery" and "Dynamic CSS" options delay the scripts payment methods need. In Divi > Theme Options > Performance, turn off deferring jQuery, and do not assign a Theme Builder template to the checkout page.', 'aiolos-checkout-for-woocommerce' ) ); } if ( 'avada' === $template || class_exists( 'Avada' ) ) { $found = true; $add( 'theme-avada', 'warning', __( 'Avada', 'aiolos-checkout-for-woocommerce' ), __( 'Avada changes WooCommerce\'s checkout templates and adds its own checkout layout. In Avada > Options > WooCommerce, keep the default checkout layout, and turn off "Avada\'s WooCommerce checkout" if your version has it.', 'aiolos-checkout-for-woocommerce' ) ); } if ( 'porto' === $template || defined( 'PORTO_VERSION' ) ) { $found = true; $add( 'theme-porto', 'warning', __( 'Porto', 'aiolos-checkout-for-woocommerce' ), __( 'Porto has its own checkout versions and a mini cart that opens on add to cart. In Porto > Theme Options > WooCommerce, choose the default checkout, and pick one cart: Porto\'s or the Aiolos side cart (Side cart tab).', 'aiolos-checkout-for-woocommerce' ) ); } if ( defined( 'ASTRA_EXT_VER' ) ) { $found = true; $add( 'theme-astra-pro', 'warning', __( 'Astra Pro', 'aiolos-checkout-for-woocommerce' ), __( 'Astra Pro\'s WooCommerce module has its own checkout layouts ("Modern checkout", "Two step") and a slide-in cart. In Appearance > Customize > WooCommerce > Checkout, keep the default layout; and use one slide-in cart only.', 'aiolos-checkout-for-woocommerce' ) ); } if ( function_exists( 'woostify_options' ) ) { $options = woostify_options( false ); $ajax = is_array( $options ) && ! empty( $options['shop_single_ajax_add_to_cart'] ); if ( $ajax || 'woostify' === $template ) { $found = true; $add( 'theme-woostify', $ajax && Settings::enabled( 'side_cart_enabled' ) ? 'warning' : 'info', __( 'Woostify', 'aiolos-checkout-for-woocommerce' ), __( 'Woostify adds products to the cart without reloading and opens its own cart. Together with the Aiolos side cart a product can be added twice. Turn off Woostify\'s "Ajax single add to cart" (Customize > WooCommerce > Product single), or "Add to cart without reloading" in the Side cart tab.', 'aiolos-checkout-for-woocommerce' ), Admin::url( 'side_cart' ), __( 'Side cart', 'aiolos-checkout-for-woocommerce' ) ); } } if ( ! $found ) { /* translators: %s: theme name */ $add( 'theme', 'ok', __( 'Theme', 'aiolos-checkout-for-woocommerce' ), sprintf( __( '%s: no known problems with custom checkouts.', 'aiolos-checkout-for-woocommerce' ), (string) $theme->get( 'Name' ) ) ); } } /** * Filters from other plugins or the theme that change our settings or WooCommerce's checkout * options from code: the settings screen then shows values the shop does not get. * * @param callable $add Adder. */ private static function overrides( callable $add ): void { $hooks = array( 'option_' . Settings::OPTION => __( 'Aiolos Checkout settings', 'aiolos-checkout-for-woocommerce' ), 'pre_option_' . Settings::OPTION => __( 'Aiolos Checkout settings', 'aiolos-checkout-for-woocommerce' ), 'aiolos_load_checkout' => __( 'whether the checkout loads', 'aiolos-checkout-for-woocommerce' ), 'aiolos_side_cart_visible' => __( 'whether the side cart shows', 'aiolos-checkout-for-woocommerce' ), 'woocommerce_enable_order_notes_field' => __( 'the order notes field', 'aiolos-checkout-for-woocommerce' ), 'pre_option_woocommerce_enable_ajax_add_to_cart' => __( 'add to cart without reloading', 'aiolos-checkout-for-woocommerce' ), 'woocommerce_coupons_enabled' => __( 'the discount code field', 'aiolos-checkout-for-woocommerce' ), ); $found = array(); foreach ( $hooks as $hook => $what ) { foreach ( self::foreign_callbacks( $hook ) as $source ) { $found[ $what ][ $source ] = $source; } } if ( ! $found ) { return; } $parts = array(); foreach ( $found as $what => $sources ) { $parts[] = $what . ': ' . implode( ', ', $sources ); } $add( 'overrides', 'info', __( 'Settings changed from code', 'aiolos-checkout-for-woocommerce' ), /* translators: %s: list of "what: by whom" */ sprintf( __( 'Code on this site changes these, so the shop may behave differently from what this screen shows: %s.', 'aiolos-checkout-for-woocommerce' ), implode( '; ', $parts ) ) ); } /** * Who hooked a filter, other than this plugin, Pro and the translation plugins. * * @param string $hook Hook. * @return string[] Plugin folder or theme names. */ private static function foreign_callbacks( string $hook ): array { global $wp_filter; if ( empty( $wp_filter[ $hook ] ) || ! is_object( $wp_filter[ $hook ] ) || ! isset( $wp_filter[ $hook ]->callbacks ) ) { return array(); } $out = array(); foreach ( (array) $wp_filter[ $hook ]->callbacks as $callbacks ) { foreach ( (array) $callbacks as $callback ) { $file = self::callback_file( $callback['function'] ?? null ); if ( '' === $file ) { continue; } $source = self::source( $file ); if ( '' !== $source ) { $out[ $source ] = $source; } } } return array_values( $out ); } /** * The file a callback is defined in. * * @param mixed $callback Callback. */ private static function callback_file( $callback ): string { try { if ( is_string( $callback ) && false !== strpos( $callback, '::' ) ) { $callback = explode( '::', $callback, 2 ); } if ( is_array( $callback ) && 2 === count( $callback ) && is_string( $callback[1] ) ) { $reflection = new \ReflectionMethod( is_object( $callback[0] ) ? get_class( $callback[0] ) : (string) $callback[0], $callback[1] ); } elseif ( $callback instanceof \Closure || ( is_string( $callback ) && function_exists( $callback ) ) ) { $reflection = new \ReflectionFunction( $callback ); } elseif ( is_object( $callback ) && method_exists( $callback, '__invoke' ) ) { $reflection = new \ReflectionMethod( $callback, '__invoke' ); } else { return ''; } return (string) $reflection->getFileName(); } catch ( \ReflectionException $e ) { return ''; } } /** * A readable source for a file: plugin folder, "theme", or "" for ours, WordPress core and * the translation plugins (which translate the settings on purpose). * * @param string $file File. */ private static function source( string $file ): string { $file = wp_normalize_path( $file ); $plugins = wp_normalize_path( WP_PLUGIN_DIR ) . '/'; $mu = wp_normalize_path( WPMU_PLUGIN_DIR ) . '/'; $themes = wp_normalize_path( get_theme_root() ) . '/'; if ( 0 === strpos( $file, $plugins ) ) { $folder = strtok( substr( $file, strlen( $plugins ) ), '/' ); $skip = array( 'aiolos-checkout-for-woocommerce', 'aiolos-checkout-pro', 'sitepress-multilingual-cms', 'wpml-string-translation', 'polylang', 'polylang-pro', 'woocommerce' ); return in_array( $folder, $skip, true ) ? '' : (string) $folder; } if ( 0 === strpos( $file, $mu ) ) { /* translators: %s: file name */ return sprintf( __( 'must-use plugin %s', 'aiolos-checkout-for-woocommerce' ), basename( $file ) ); } if ( 0 === strpos( $file, $themes ) ) { return __( 'the theme', 'aiolos-checkout-for-woocommerce' ); } return ''; } /** * Scripts other code took away from the checkout (seen on the last checkout view). * * @param callable $add Adder. */ private static function runtime( callable $add ): void { $seen = get_option( self::RUNTIME, array() ); if ( ! is_array( $seen ) || empty( $seen['time'] ) ) { return; } if ( isset( $seen['selectwoo'] ) && ! $seen['selectwoo'] ) { $add( 'selectwoo', 'warning', __( 'Country search is missing on the checkout', 'aiolos-checkout-for-woocommerce' ), __( 'On the last checkout view WooCommerce\'s selectWoo script (the searchable country and state lists) did not load: the theme or a plugin removes it. Look for a "disable select2" option in the theme or an optimization plugin, or a snippet that dequeues "selectWoo".', 'aiolos-checkout-for-woocommerce' ) ); } if ( isset( $seen['checkout'] ) && ! $seen['checkout'] ) { $add( 'wc-checkout', 'error', __( 'WooCommerce\'s checkout script is missing', 'aiolos-checkout-for-woocommerce' ), __( 'On the last checkout view the "wc-checkout" script did not load, so orders cannot be placed. A plugin or the theme removes it: deactivate optimization plugins one by one to find it.', 'aiolos-checkout-for-woocommerce' ) ); } } /** * WP-Cron and Action Scheduler running late (reminders, scheduled clean-ups). * * @param callable $add Adder. */ private static function scheduled( callable $add ): void { $late = 0; $stuck = array(); $cron = function_exists( '_get_cron_array' ) ? _get_cron_array() : array(); foreach ( is_array( $cron ) ? $cron : array() as $time => $events ) { if ( (int) $time < time() - HOUR_IN_SECONDS ) { $late += is_array( $events ) ? count( $events ) : 0; } } if ( $late > 0 ) { $add( 'cron', 'warning', __( 'Scheduled tasks are late', 'aiolos-checkout-for-woocommerce' ), ( defined( 'DISABLE_WP_CRON' ) && DISABLE_WP_CRON ) /* translators: %d: number of tasks */ ? sprintf( _n( '%d WordPress task is more than an hour late. WP-Cron is switched off here (DISABLE_WP_CRON): make sure the server runs wp-cron.php every few minutes.', '%d WordPress tasks are more than an hour late. WP-Cron is switched off here (DISABLE_WP_CRON): make sure the server runs wp-cron.php every few minutes.', $late, 'aiolos-checkout-for-woocommerce' ), $late ) /* translators: %d: number of tasks */ : sprintf( _n( '%d WordPress task is more than an hour late. WP-Cron runs when someone visits: on a quiet site, ask your host for a real cron job that runs wp-cron.php every few minutes.', '%d WordPress tasks are more than an hour late. WP-Cron runs when someone visits: on a quiet site, ask your host for a real cron job that runs wp-cron.php every few minutes.', $late, 'aiolos-checkout-for-woocommerce' ), $late ) ); } if ( function_exists( 'as_get_scheduled_actions' ) && class_exists( 'ActionScheduler_Store' ) ) { try { $stuck = as_get_scheduled_actions( array( 'status' => \ActionScheduler_Store::STATUS_PENDING, 'date' => gmdate( 'Y-m-d H:i:s', time() - HOUR_IN_SECONDS ), 'date_compare' => '<=', 'per_page' => 1, ), 'ids' ); } catch ( \Throwable $e ) { $stuck = array(); } if ( $stuck ) { $add( 'action-scheduler', 'warning', __( 'WooCommerce\'s scheduled actions are stuck', 'aiolos-checkout-for-woocommerce' ), __( 'Some actions are more than an hour past their time (emails, reminders, webhooks). Check WooCommerce > Status > Scheduled Actions for failures, and that WP-Cron runs.', 'aiolos-checkout-for-woocommerce' ), admin_url( 'admin.php?page=wc-status&tab=action-scheduler&status=past-due' ), __( 'Scheduled actions', 'aiolos-checkout-for-woocommerce' ) ); } } if ( 0 === $late && ! $stuck ) { $add( 'scheduled', 'ok', __( 'Scheduled tasks', 'aiolos-checkout-for-woocommerce' ), __( 'Running on time.', 'aiolos-checkout-for-woocommerce' ) ); } } /** * Page caches and optimizers: the ones this plugin configures, and the ones it cannot. * * @param callable $add Adder. */ private static function caches( callable $add ): void { $handled = array( 'WP Rocket' => defined( 'WP_ROCKET_VERSION' ), 'LiteSpeed Cache' => defined( 'LSCWP_V' ), 'W3 Total Cache' => defined( 'W3TC' ), 'WP Super Cache' => defined( 'WPCACHEHOME' ), 'WP Fastest Cache' => class_exists( 'WpFastestCache' ), 'SiteGround Speed Optimizer' => class_exists( 'SiteGround_Optimizer\\Loader\\Loader' ) || defined( 'SiteGround_Optimizer\\VERSION' ), 'Autoptimize' => defined( 'AUTOPTIMIZE_PLUGIN_VERSION' ), 'Perfmatters' => defined( 'PERFMATTERS_VERSION' ), 'FlyingPress' => defined( 'FLYING_PRESS_VERSION' ), 'Hummingbird' => defined( 'WPHB_VERSION' ), 'Cache Enabler' => defined( 'CACHE_ENABLER_VERSION' ), 'Breeze' => defined( 'BREEZE_VERSION' ), ); $unknown = array( 'WP-Optimize' => defined( 'WPO_VERSION' ), 'NitroPack' => defined( 'NITROPACK_VERSION' ), 'Swift Performance' => defined( 'SWIFT_PERFORMANCE_VER' ), 'Jetpack Boost' => defined( 'JETPACK_BOOST_VERSION' ), 'Comet Cache' => defined( 'COMET_CACHE_PLUGIN_FILE' ) || class_exists( 'WebSharks\\CometCache\\Plugin' ), 'WP Optimize Speed' => defined( 'WPOPT_VERSION' ), 'Speed Optimizer' => defined( 'SPEED_OPTIMIZER_VERSION' ), ); $handled = array_keys( array_filter( $handled ) ); $unknown = array_keys( array_filter( $unknown ) ); if ( $unknown ) { $add( 'cache-unknown', 'warning', __( 'A caching plugin needs exclusions', 'aiolos-checkout-for-woocommerce' ), /* translators: %s: plugin names */ sprintf( __( '%s is not set up by Aiolos Checkout automatically. In its settings, exclude the cart, checkout and my-account pages from the page cache, and the files of aiolos-checkout-for-woocommerce (and -pro) and wp-includes/js/dist from "delay JavaScript" and "remove unused CSS".', 'aiolos-checkout-for-woocommerce' ), implode( ', ', $unknown ) ) ); } if ( $handled ) { /* translators: %s: plugin names */ $add( 'cache', 'ok', __( 'Caching', 'aiolos-checkout-for-woocommerce' ), sprintf( __( '%s: the checkout is kept out of the cache and our scripts out of delaying, automatically.', 'aiolos-checkout-for-woocommerce' ), implode( ', ', $handled ) ) ); } } /** * The free shipping bar against the shipping zones. * * @param callable $add Adder. */ private static function shipping_bar( callable $add ): void { if ( ! Settings::enabled( 'side_cart_enabled' ) || ! Settings::enabled( 'free_shipping_bar' ) || ! class_exists( 'WC_Shipping_Zones' ) ) { return; } $amounts = array(); $zones = \WC_Shipping_Zones::get_zones(); $zones[] = array( 'zone_id' => 0 ); foreach ( $zones as $zone ) { $object = \WC_Shipping_Zones::get_zone( (int) ( $zone['zone_id'] ?? 0 ) ); if ( ! $object ) { continue; } foreach ( $object->get_shipping_methods( true ) as $method ) { if ( 'free_shipping' === $method->id ) { $requires = (string) $method->get_option( 'requires', '' ); $amount = (float) $method->get_option( 'min_amount', 0 ); if ( in_array( $requires, array( 'min_amount', 'either', 'both' ), true ) && $amount > 0 ) { $amounts[] = $amount; } else { $amounts[] = 0.0; } } } } $threshold = Settings::get( 'free_shipping_threshold', '' ); if ( ! $amounts ) { if ( '' !== $threshold && is_numeric( $threshold ) && (float) $threshold > 0 ) { $add( 'free-shipping', 'warning', __( 'The free shipping bar promises free shipping', 'aiolos-checkout-for-woocommerce' ), __( 'The side cart\'s bar counts down to free shipping, but no shipping zone has a "Free shipping" method, so customers who reach it still pay. Add the method in WooCommerce > Settings > Shipping, or turn the bar off.', 'aiolos-checkout-for-woocommerce' ), admin_url( 'admin.php?page=wc-settings&tab=shipping' ), __( 'Shipping zones', 'aiolos-checkout-for-woocommerce' ) ); } return; } if ( '' !== $threshold && is_numeric( $threshold ) && (float) $threshold > 0 && ! in_array( round( (float) $threshold, 2 ), array_map( static fn( $a ) => round( $a, 2 ), $amounts ), true ) ) { $add( 'free-shipping', 'warning', __( 'The free shipping bar and the shipping zones disagree', 'aiolos-checkout-for-woocommerce' ), /* translators: 1: bar threshold, 2: zone minimum amounts */ sprintf( __( 'The bar counts down to %1$s, but the "Free shipping" methods ask for %2$s. Leave the bar\'s threshold empty to follow the zones, or make them match.', 'aiolos-checkout-for-woocommerce' ), wp_strip_all_tags( wc_price( (float) $threshold ) ), implode( ', ', array_map( static fn( $a ) => wp_strip_all_tags( wc_price( $a ) ), array_unique( $amounts ) ) ) ), Admin::url( 'side_cart' ), __( 'Side cart', 'aiolos-checkout-for-woocommerce' ) ); } } /** * Cart recovery switched on with nothing to send (Pro answers `aiolos_health_recovery_steps`). * * @param callable $add Adder. */ private static function recovery( callable $add ): void { if ( ! Settings::enabled( 'recovery_enabled' ) ) { return; } /** * Filters how many cart recovery emails are switched on (null: unknown). * * @since 1.6.0 * * @param int|null $steps Steps. */ $steps = apply_filters( 'aiolos_health_recovery_steps', null ); if ( null !== $steps && (int) $steps <= 0 ) { $add( 'recovery-steps', 'warning', __( 'Cart recovery sends nothing', 'aiolos-checkout-for-woocommerce' ), __( 'Cart recovery is on, but every reminder email is off, so carts are saved and nobody is reminded. Turn on at least one reminder, or turn cart recovery off.', 'aiolos-checkout-for-woocommerce' ), Admin::url( 'recovery' ), __( 'Cart recovery', 'aiolos-checkout-for-woocommerce' ) ); } } /** * Express gateways found. * * @param callable $add Adder. */ private static function express( callable $add ): void { $found = Express::detected(); if ( ! $found ) { return; } $names = wp_list_pluck( array_filter( $found, static fn( $g ) => $g['enabled'] ), 'name' ); if ( ! $names ) { return; } /* translators: %s: gateway names */ $add( 'express', 'info', __( 'Express payments', 'aiolos-checkout-for-woocommerce' ), sprintf( __( 'Found: %s.', 'aiolos-checkout-for-woocommerce' ), implode( ', ', $names ) ), Admin::url( Express::TAB ), __( 'Where they show', 'aiolos-checkout-for-woocommerce' ) ); } /** * Order storage (HPOS). * * @param callable $add Adder. */ private static function hpos( callable $add ): void { $util = \Automattic\WooCommerce\Utilities\OrderUtil::class; if ( ! class_exists( $util ) || ! method_exists( $util, 'custom_orders_table_usage_is_enabled' ) ) { return; } $hpos = $util::custom_orders_table_usage_is_enabled(); $sync = 'yes' === get_option( 'woocommerce_custom_orders_table_data_sync_enabled', 'no' ); $text = $hpos ? ( $sync ? __( 'High-performance order storage is on, with copies kept in the old tables.', 'aiolos-checkout-for-woocommerce' ) : __( 'High-performance order storage is on. Aiolos Checkout supports it.', 'aiolos-checkout-for-woocommerce' ) ) : __( 'Orders are kept in the WordPress posts tables (HPOS off). Aiolos Checkout works with both.', 'aiolos-checkout-for-woocommerce' ); $add( 'hpos', 'ok', __( 'Order storage', 'aiolos-checkout-for-woocommerce' ), $text ); } /** * The card. * * @param bool $compact Only the problems, with a link to the full list (General tab). */ public static function render( bool $compact = false ): void { $checks = self::checks(); if ( $compact ) { $problems = self::problems(); if ( ! $problems ) { return; } ?>

__( 'Problem', 'aiolos-checkout-for-woocommerce' ), 'warning' => __( 'Check', 'aiolos-checkout-for-woocommerce' ), 'info' => __( 'Note', 'aiolos-checkout-for-woocommerce' ), 'ok' => __( 'Good', 'aiolos-checkout-for-woocommerce' ), ); ?>