parent
564802a9c4
commit
0c30999a67
|
@ -1979,8 +1979,8 @@ class WC_Admin_Post_Types {
|
|||
$user_id = get_post_meta( $id, '_customer_user', true );
|
||||
|
||||
if ( $user_id > 0 ) {
|
||||
update_user_meta( $user_id, '_order_count', '' );
|
||||
update_user_meta( $user_id, '_money_spent', '' );
|
||||
delete_user_meta( $user_id, '_money_spent' );
|
||||
delete_user_meta( $user_id, '_order_count' );
|
||||
}
|
||||
|
||||
$refunds = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = 'shop_order_refund' AND post_parent = %d", $id ) );
|
||||
|
@ -2014,8 +2014,8 @@ class WC_Admin_Post_Types {
|
|||
$user_id = get_post_meta( $id, '_customer_user', true );
|
||||
|
||||
if ( $user_id > 0 ) {
|
||||
update_user_meta( $user_id, '_order_count', '' );
|
||||
update_user_meta( $user_id, '_money_spent', '' );
|
||||
delete_user_meta( $user_id, '_money_spent' );
|
||||
delete_user_meta( $user_id, '_order_count' );
|
||||
}
|
||||
|
||||
$refunds = $wpdb->get_results( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type = 'shop_order_refund' AND post_parent = %d", $id ) );
|
||||
|
|
|
@ -579,6 +579,12 @@ function wc_delete_shop_order_transients( $post_id = 0 ) {
|
|||
delete_transient( $transient );
|
||||
}
|
||||
|
||||
// Clear money spent for user associated with order
|
||||
if ( $post_id && ( $user_id = get_post_meta( $post_id, '_customer_user', true ) ) ) {
|
||||
delete_user_meta( $user_id, '_money_spent' );
|
||||
delete_user_meta( $user_id, '_order_count' );
|
||||
}
|
||||
|
||||
// Increments the transient version to invalidate cache
|
||||
WC_Cache_Helper::get_transient_version( 'orders', true );
|
||||
|
||||
|
|
Loading…
Reference in New Issue