What's new

How to correctly use cancelled WooCommerce booking action hook?


Active member
Staff member
I'm trying to make an SQL query to run upon cancellation of a booking, via a custom plugin, updating custom user meta data.

Here's my code:

function wporg_callback() {
global $wpdb;
$wpdb->query("UPDATE usermeta SET meta_value = 15 WHERE umeta_id = 131");

add_action('woocommerce_bookings_cancelled_booking', 'wporg_callback');

It's not making any changes.
Is there something wrong with the query? Is the right action not being used?

Continue reading...