Created
February 28, 2024 09:06
-
-
Save dennisnissle/5c754102e75469bdcdd22682084176f5 to your computer and use it in GitHub Desktop.
Use a different invoice template based on country
This file contains 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 ) { | |
$country = $invoice->get_taxable_country(); | |
$template_id = false; | |
if ( 'AT' === $country ) { | |
$template_id = 320; | |
} elseif ( $invoice->is_eu() ) { | |
$template_id = 323; | |
} elseif ( $invoice->is_third_country() ) { | |
$template_id = 325; | |
} | |
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