add_action('woocommerce_payment_complete', 'action_payment_complete', 30, 1);
function action_payment_complete($order_id) {
global $wpdb, $current_user;
$order = wc_get_order($order_id);
foreach ($order->get_items() as $item) {
$_product = apply_filters('woocommerce_order_item_product', $order->get_product_from_item($item), $item);
$item_meta = new WC_Order_Item_Meta($item['item_meta'], $_product);
$p_name = $_product->name . ' Purchased';
$add_activity = $wpdb->query("INSERT INTO `user_activity_log`(`activity_name`, `user_id`) VALUES ('$p_name', '$current_user->ID')");
}
}
Show Comments

