I would like to execute my PHP code after the administrator manually changes the order status to completed in the Woocommerce dashboard.
I have this but it doesn’t work:
add_action( 'woocommerce_payment_complete', 'wenn_payment_complete' );
function wenn_payment_complete( $order_id ){
$order = wc_get_order( $order_id );
$customer_id = $order->get_customer_id();
global $wpdb;
$wpdb->query($wpdb->prepare("UPDATE lpd7_users SET ok = '1' WHERE ID=$customer_id"));
}
It is the right hook?
New contributor
Bartek Pesz is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.