Werte in eine benutzerdefinierte Tabelle einfügen, sobald die Bestellung in Woocommerce @ aufgegeben wur

Ich muss in meine benutzerdefinierte Tabelle mit dem Namen @ einfüg license_table

 **username**, **order id**, **Quantity** 
 This needs to be populated when an order is placed. 
Username = customer's email id
 Quantity = quantity (of the product)
order id=Order ID

Ich habe verwendet, aber nicht funktioniert

add_action( 'woocommerce_order_status_completed', 'my_function' );
function my_function($order_id) {
    global $wpdb;
    $order = new WC_order($order_id);
    $customer_id= $order->id;
    $email= $order->billing_email;
    $email1= $order->id;
    $table_name =  "aitoe_license_table";
    $wpdb->insert( $table_name, array(
      'username' => $customer_id,
       'order_id' => $email,
       'number_of_cameras' => 12,
      'boolean' => 'False',
    ) );

   }

Antworten auf die Frage(2)

Ihre Antwort auf die Frage