I found the below script somewhere on here before and having trouble getting it to work. Basically I want to copy basic order details into a new table (which is in the same database), so I can run some reports off of it from non wordpress page. I have changed the table name and fields and copied this into my functions.php in the theme. But it doesnt seem to do anything. Any help would be great, im really stuck. I'm running woocommerce 2.2.8 if that makes any difference.
function add_neworders ($order_id) {
global $woocommerce;
$order = new WC_Order( $order_id );
$total = $order->order_total;
$date = $order->order_date;
global $wpdb;
$table = $wpdb->prefix . 'finacedata';
$wpdb->insert($table, array(
'desctipion' => $name,
'status' => '2',
'date' => $date,
'amount' => $total,
'invoice' => $order_id,
));
add_action( 'woocommerce_new_order', 'add_neworders' );}