2
我需要插入到我的自定義表稱爲license_table值插入自定義表一旦訂單被放置在Woocommerce
**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
我已經使用但不能正常工作
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',
));
}