Last active
August 15, 2016 22:41
-
-
Save dancameron/346415eba8eb33acb65a to your computer and use it in GitHub Desktop.
Automatically Send Invoice after it's Auto Generated
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 | |
function auto_send_invoice_after_creation( $old_invoice_id, $new_invoice_id ) { | |
$invoice = SI_Invoice::get_instance( $new_invoice_id ); | |
$client = $invoice->get_client(); | |
$client_users = $client->get_associated_users(); | |
if ( !empty( $client_users ) ) { | |
do_action( 'send_invoice', $invoice, $client_users ); | |
} | |
} | |
add_action( 'si_recurring_invoice_created', 'auto_send_invoice_after_creation', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment