How to download the invoice when order has not been paid?

By default the invoice can be downloaded from the account page when the order has been paid for which means that status should be ‘Processing’ or ‘Completed’.

If you would like to override this behaviour and show the invoice regardless of the status, use below filters.

/**
 * Always show invoice shortcode button.
 *
 * @param bool   $show    Show the invoice button.
 * @param object $invoice Invoice object.
 *
 * @return bool
 */
function wpi_always_show_download_invoice_shortcode_button( $show, $invoice ) {
	return true;
}
add_filter( 'wpi_show_download_invoice_shortcode', 'wpi_always_show_download_invoice_shortcode_button', 99, 2 );
/**
 * Always show invoice button in my account.
 *
 * @param bool   $show    Show the invoice button.
 * @param object $invoice Invoice object.
 *
 * @return bool
 */
function wpi_always_show_my_account_pdf_button( $show, $invoice ) {
	return true;
}
add_filter( 'wpi_show_my_account_pdf', 'wpi_always_show_my_account_pdf_button', 99, 2 );