health_gated() && ! Health::is_healthy() ) { return Health::unhealthy_error(); } return true; } /** * Check the WooCommerce admin capability and sync-store health. * * @return bool|WP_Error */ public function admin_permissions_check( WP_REST_Request $request ) { if ( ! current_user_can( 'manage_woocommerce' ) ) { return false; } if ( $this->health_gated() && ! Health::is_healthy() ) { return Health::unhealthy_error(); } return true; } /** * Whether this controller's endpoints refuse to run on a broken/half-installed * store (F13). Default yes. Override to false ONLY for an admin/repair endpoint * that neither reads nor writes the gated tables and that an operator * legitimately needs while the sync store is broken, or for the status * endpoint that reports whether those tables exist. */ protected function health_gated(): bool { return true; } }