| 1 |
<?php |
| 2 |
/** |
| 3 |
* WP Overnight invoice receipt template. |
| 4 |
* |
| 5 |
* Renders inline HTML by delegating to PDF Invoices & Packing Slips for WooCommerce. |
| 6 |
* |
| 7 |
* @package WCPOS\WooCommercePOS |
| 8 |
*/ |
| 9 |
|
| 10 |
// phpcs:disable WordPress.NamingConventions.PrefixAllGlobals -- Template files use short variable names by convention. |
| 11 |
|
| 12 |
if ( ! \defined( 'ABSPATH' ) ) { |
| 13 |
exit; |
| 14 |
} |
| 15 |
|
| 16 |
if ( empty( $order ) ) { |
| 17 |
echo esc_html__( 'The WP Overnight invoice document is not available.', 'woocommerce-pos' ); |
| 18 |
return; |
| 19 |
} |
| 20 |
|
| 21 |
$document = apply_filters( 'woocommerce_pos_wp_overnight_pdf_document', null, 'invoice', $order ); |
| 22 |
|
| 23 |
if ( null === $document && \function_exists( 'wcpdf_get_document' ) ) { |
| 24 |
$document = wcpdf_get_document( 'invoice', $order, true ); |
| 25 |
} |
| 26 |
|
| 27 |
if ( ! $document || ! \is_callable( array( $document, 'get_html' ) ) ) { |
| 28 |
echo esc_html__( 'The WP Overnight invoice document could not be rendered for this order.', 'woocommerce-pos' ); |
| 29 |
return; |
| 30 |
} |
| 31 |
|
| 32 |
echo $document->get_html(); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Trusted HTML generated by the WP Overnight document API. |
| 33 |
|