From 3e0dbda98f5899823662b004d036d845f2e8212e Mon Sep 17 00:00:00 2001 From: Justin Palmer <228780+layoutd@users.noreply.github.com> Date: Fri, 31 Oct 2025 23:19:30 +0100 Subject: [PATCH] Add error handling for order generation in CLI. Notify users when no orders are generated due to lack of published products. --- includes/CLI.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/includes/CLI.php b/includes/CLI.php index 823b3fe..da0d710 100644 --- a/includes/CLI.php +++ b/includes/CLI.php @@ -115,6 +115,10 @@ function () use ( $progress ) { $execution_time = round( ( $time_end - $time_start ), 2 ); $display_time = $execution_time < 60 ? $execution_time . ' seconds' : human_time_diff( $time_start, $time_end ); + if ( $generated === 0 && $amount > 0 ) { + WP_CLI::error( 'No orders were generated. Make sure there are published products in your store.' ); + } + WP_CLI::success( $generated . ' orders generated in ' . $display_time ); }