Skip to content

Instantly share code, notes, and snippets.

@dennisnissle
Created November 28, 2025 08:44
Show Gist options
  • Select an option

  • Save dennisnissle/6c0789e61b30f6a4f57f96a113a30444 to your computer and use it in GitHub Desktop.

Select an option

Save dennisnissle/6c0789e61b30f6a4f57f96a113a30444 to your computer and use it in GitHub Desktop.
Use a different invoice template for orders with company field
<?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