1. Home
  2. Developers
  3. wpinv_status_{$old_status}_to_{$new_status}

wpinv_status_{$old_status}_to_{$new_status}

Fires after an invoice status has been changed from one status to another.

do_action( 'wpinv_status_' . $old_status . '_to_' . $new_status, int $invoice_id, string $old_status );

$old_status and $new_status, refer to the old and new invoice statuses, respectively.

Parameters

$invoice_id

(int) The Invoice ID.

$old_status

(string) Invoice old status. Learn more

Examples

Handle event on invoice status has been changed from Pending Payment(wpi-pending) to Paid(publish).

function _wpi_wpinv_status_pending_to_paid( $invoice_id, $old_status ) {
    // Invoice object
    $invoice = wpinv_get_invoice( $invoice_id );

    // Invoice items
    $cart_items = $invoice->get_cart_details();

    // Do your stuff here
}
add_action( 'wpinv_status_wpi-pending_to_publish', '_wpi_wpinv_status_pending_to_paid', 10, 2 );
Was this helpful to you? Yes No