'Cart','checkout'=>'Checkout','myaccount'=>'My account'] as $key=>$title) { $id = (int)wc_get_page_id($key); $post = $id>0 ? get_post($id) : null; $published = $post instanceof WP_Post && $post->post_status==='publish'; $add($key.'_page',$title.' page',$published?'pass':'warn',$published?"Published (#$id)":"No published page assigned","Confirm the WooCommerce advanced page setting."); if ($published && $key!=='myaccount') { $sc = $key==='cart'?'woocommerce_cart':'woocommerce_checkout'; $ui = has_shortcode($post->post_content,$sc) || (function_exists('has_block') && has_block('woocommerce/'.$key,$post)); $add($key.'_content',$title.' UI',$ui?'pass':'warn',$ui?'Standard WooCommerce block or shortcode found':'Standard block or shortcode not found','Manually check this page and exclusions from page caching.'); } } $scheme = (string)wp_parse_url(home_url('/'),PHP_URL_SCHEME); $add('https','HTTPS home URL',$scheme==='https'?'pass':'warn',"Configured scheme: $scheme",'Secure and manually verify production storefront and checkout.'); $gateways = []; foreach(WC()->payment_gateways()->payment_gateways() as $gateway) { if (isset($gateway->enabled) && $gateway->enabled==='yes') $gateways[]=(string)$gateway->id; } $add('gateway','Enabled payment methods',count($gateways)?'pass':'warn', count($gateways)?('Settings-level enabled: '.implode(', ',$gateways).'. Not a successful charge.'):'None enabled', 'Check gateway availability and complete authorized sandbox payment tests.'); $zones=class_exists('WC_Shipping_Zones')?WC_Shipping_Zones::get_zones():[]; $methods=0; foreach($zones as $z) { if (!empty($z['zone_id'])) $methods += count((new WC_Shipping_Zone((int)$z['zone_id']))->get_shipping_methods(true)); } if (class_exists('WC_Shipping_Zone')) $methods += count((new WC_Shipping_Zone(0))->get_shipping_methods(true)); $add('shipping','Shipping methods',$methods?'pass':'warn',count($zones)." zones, $methods enabled methods, including default",'Test destination-specific rates and product restrictions on staging.'); $currency=(string)get_woocommerce_currency(); $add('currency','Store currency',$currency?'pass':'warn',$currency?:'Not configured','Confirm prices, currency and tax behavior with the business.'); $published=(int)(wp_count_posts('product')->publish??0); $add('products','Published products',$published?'pass':'warn',"$published published; not a purchasability check",'Test simple/variable products, stock, cart and coupons.'); $permalinks=(string)get_option('permalink_structure',''); $add('permalinks','Permalinks',$permalinks?'pass':'warn',$permalinks?'Non-plain structure configured':'Plain permalinks configured','Review storefront URL and redirect requirements.'); $cron=defined('DISABLE_WP_CRON') && DISABLE_WP_CRON; $add('cron','Scheduled tasks',$cron?'info':'pass',$cron?'Request-triggered WP Cron disabled':'Request-triggered WP Cron not disabled','Verify Action Scheduler job execution; this is not an outcome test.'); return self::finish($checks); } private static function finish(array $checks):array { $counts=['pass'=>0,'warn'=>0,'info'=>0]; foreach($checks as $c) $counts[$c['status']]++; return ['tool'=>'Web100 Preflight','version'=>'0.1.0','mode'=>'read_only', 'limits'=>'Not a security audit, live payment check, or complete checkout test.', 'counts'=>$counts,'checks'=>$checks]; } public static function menu():void { add_submenu_page('woocommerce','Web100 Preflight','Web100 Preflight', 'manage_woocommerce','web100-preflight',[self::class,'page']); } public static function page():void { if (!current_user_can('manage_woocommerce')) wp_die('Access denied'); $r=self::report(); echo '

Web100 WooCommerce Preflight

Read-only, no telemetry, customer data or live charge. Non-exhaustive.

'; echo '

'.esc_html(wp_json_encode($r['counts'])).'

'; foreach($r['checks'] as $c) echo ''; echo '
CheckStatusFindingNext step
'.esc_html($c['name']).''.esc_html(strtoupper($c['status'])).''.esc_html($c['finding']).''.esc_html($c['next']).'
'; } public static function cli($args,$assoc):void { if (($assoc['format']??'json')!=='json') WP_CLI::error('Only --format=json supported'); WP_CLI::line(wp_json_encode(self::report(), JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES)); } } add_action('admin_menu',[Web100_Preflight::class,'menu']); if(defined('WP_CLI') && WP_CLI && class_exists('WP_CLI')) { WP_CLI::add_command('web100 preflight',[Web100_Preflight::class,'cli']); }