Привет. Я пытаюсь отправить данные в пользовательскую таблицу при отправке заказа.
add_action('woocommerce_payment_complete', 'action_payment_complete', 30, 1);
function action_payment_complete($order_id)
{
// Getting an instance of the order object
global $wpdb;
$order = wc_get_order($order_id);
// print_r("hello");
$table_name = $wpdb->prefix . 'notificaions';
$user_id = $order->get_user_id(); // Get the costumer ID
$user = $order->get_user(); // Get the WP_User object
$data = array(
'user_id' => (int) $user_id,
'message' => "Hello An order has been placed!\n",
'created_at' => time()
);
$wpdb->insert($table_name, $data);
}
* 1006. происходит плз, наведите меня на это. заранее спасибо