Created
June 10, 2014 04:04
-
-
Save justinstern/af2413a2a648d7fc2a1b to your computer and use it in GitHub Desktop.
Snippet to automatically assign a invoice number to an order when payment is successfully completed http://www.woothemes.com/products/print-invoices-packing-lists/
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 the following to the bottom of your theme's functions.php | |
add_action( 'woocommerce_payment_complete', 'set_pip_invoice_number' ); | |
function set_pip_invoice_number( $order_id ) { | |
$order = new WC_Order( $order_id ); | |
if ( in_array( $order->status, array( 'processing', 'completed' ) ) && function_exists( 'woocommerce_pip_invoice_number' ) ) { | |
woocommerce_pip_invoice_number( $order_id ); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment