Forked from bryceadams/gist:050d886159265d6f5e6dbce649552704
Created
May 11, 2019 02:32
-
-
Save kurtschlatzer/6f58cb9c7099c93ffad6893d73af1fed to your computer and use it in GitHub Desktop.
Disable WooCommerce total spent / order count meta calculations
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'get_user_metadata', 'mtkdocs_filter_user_metadata', 10, 4 ); | |
function mtkdocs_filter_user_metadata( $value, $object_id, $meta_key, $single ) { | |
// Check if it's one of the keys we want to filter | |
if ( in_array( $meta_key, array( '_money_spent', '_order_count' ) ) ) { | |
// Return 0 so WC doesn't try calculate it | |
return 0; | |
} | |
// Default | |
return $value; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment