prefix . 'wc_order_stats'; } /** * Excluded statuses as a comma-separated list of "wc-" slugs, for FIND_IN_SET. * Status slugs are sanitize_key()'d, so they never contain commas. An empty list excludes nothing. */ public static function excluded_csv(): string { return implode( ',', array_map( static fn( string $s ): string => mb_substr( 'wc-' . $s, 0, 20 ), Analytics::excluded_statuses() ) ); } /** * Start and end of a period as wc_order_stats local date-times. * * @param Period $period Period. * @return array{0: string, 1: string} */ public static function bounds( Period $period ): array { return array( $period->start->format( 'Y-m-d H:i:s' ), $period->end->format( 'Y-m-d H:i:s' ) ); } /** * Whether WooCommerce's Cost of Goods Sold feature is on (WooCommerce 9.5 and later). */ public static function cogs_enabled(): bool { if ( ! class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { return false; } try { return (bool) \Automattic\WooCommerce\Utilities\FeaturesUtil::feature_is_enabled( 'cost_of_goods_sold' ); } catch ( \Throwable $e ) { return false; } } }