Created
August 5, 2025 08:00
-
-
Save dennisnissle/879ba74229ece962a9d1e351bba77b4c to your computer and use it in GitHub Desktop.
Adjust journal type when syncing invoice
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_action( 'storeabill_woo_order_synced_invoice', function( $invoice, $sab_order ) { | |
| $woo_order = $sab_order->get_order(); | |
| // Check products and determine whether to use a custom journal type | |
| $condition = false; | |
| if ( $condition ) { | |
| $custom_journal_type = 'custom_invoice'; | |
| if ( ! $journal = sab_get_journal( $custom_journal_type ) ) { | |
| sab_create_journal( $custom_journal_type ); | |
| } | |
| $invoice->set_journal_type( $custom_journal_type ); | |
| } | |
| }, 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment