Fix Unknown column '_customer_user' notice
When deleting a user. Also ensures the customer value on orders is set correctly to a guest user (0).
This commit is contained in:
parent
d0b82772e0
commit
6d2b570f30
|
@ -542,7 +542,7 @@ function wc_get_customer_order_count( $user_id ) {
|
|||
function wc_reset_order_customer_id_on_deleted_user( $user_id ) {
|
||||
global $wpdb;
|
||||
|
||||
$wpdb->update( $wpdb->postmeta, array( '_customer_user' => 0 ), array( '_customer_user' => $user_id ) );
|
||||
$wpdb->update( $wpdb->postmeta, array( 'meta_value' => 0 ), array( 'meta_key' => '_customer_user', 'meta_value' => $user_id ) );
|
||||
}
|
||||
|
||||
add_action( 'deleted_user', 'wc_reset_order_customer_id_on_deleted_user' );
|
||||
|
|
Loading…
Reference in New Issue