Created
November 28, 2025 08:44
-
-
Save dennisnissle/6c0789e61b30f6a4f57f96a113a30444 to your computer and use it in GitHub Desktop.
Use a different invoice template for orders with company field
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| add_filter( 'storeabill_invoice_get_template', function( $template, $invoice ) { | |
| $template_id = false; | |
| if ( ! empty( $invoice->get_company() ) ) { | |
| $template_id = 320; // Post id of the template to be used | |
| } | |
| if ( $template_id ) { | |
| if ( $template = sab_get_document_template( $template_id ) ) { | |
| return $template; | |
| } | |
| } | |
| return $template; | |
| }, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment