-1, 'orderby' => 'date', 'order' => 'DESC', 'customer_id' => $user_id, ) ); if ( $orders ) { // Get the latest order for the user. $latest_order = current( $orders ); // Calculate the time difference between the current time and the latest order's creation time. $time_difference = time() - strtotime( $latest_order->get_date_created()->date_i18n( 'Y-m-d H:i:s' ) ); // Calculate the remaining time until the user can place another order (maximum one order per hour). $remaining_time = 60 - round( $time_difference / 60 ); // Convert seconds to minutes. // If the user has placed an order within the last hour, display the notice. if ( $time_difference < 3600 ) { echo '