WooCommerce: Disable cart tracking for admins or logged-in users
If you'd like, it's possible to disable Metorik's cart tracking feature just for admins on our site.
To do so, add this PHP code to your site through a plugin like Code Snippets or your functions.php:
add_filter('metorik_cart_tracking_enabled', function () {
if (is_user_logged_in() && current_user_can('administrator')) {
return false;
}
return true;
});
You must be running version 1.6.0 or higher of the Metorik Helper plugin for this code to work.
We will turn this into a setting you can toggle from Metorik in the near future.
If you'd like to disable cart tracking for all logged-in users regardless of their role, you can use this code:
add_filter('metorik_cart_tracking_enabled', function () {
if (is_user_logged_in()) {
return false;
}
return true;
});