Skip to content

Instantly share code, notes, and snippets.

@webdados
Last active August 31, 2025 06:20
Show Gist options
  • Save webdados/d5824d91f925400552b3ff4dd3102287 to your computer and use it in GitHub Desktop.
Save webdados/d5824d91f925400552b3ff4dd3102287 to your computer and use it in GitHub Desktop.
Automatically issue proforma invoice when order is on-hold (newly created).
<?php
/**
* Automatically issue proforma invoice when order is on-hold (newly created).
* https://invoicewoo.com/
* https://nakedcatplugins.com/product/invoicing-with-invoicexpress-for-woocommerce-pro/
*/
add_action(
// When the order is created via the checkout
'woocommerce_order_status_on-hold',
function( $order_id ) {
$order = wc_get_order( $order_id );
// If the payment method is "Bank Transfer"
if ( $order->get_payment_method() === 'bacs' ) {
// Do something for BACS payment
$order->add_order_note( 'BACS payment detected - Issue proforma invoice automatically' );
do_action( 'woocommerce_order_action_hd_wc_ie_plus_generate_proforma', $order, 'automatic' );
}
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment