WordPress - Restrict some data for some users as low-level filter


I need a simple function that will block&replace some WP-WooC database widely used data (as Site Name, User Name, Taxonomies, Products Attributes, etc) from unregistered users. For example authors names will shown for unregistered users as “Register to see” with link to registration page. So I want to make a function that will be like a low-level filter and will work with ALL OTHER plugins by blocking&replacing chosen info for them too.

Sample methods:

  1. PHP code like: <?php if ( is_user_logged_in() ) { echo $123; } else { echo ‘text’; } ?> - will NOT work on a custom pages where it absent. So it must be added to each page? It’s not elegant for sure.
  2. “WooCoomerce hooks” seems that will NOT work with all other and custom plugins and custom pages etc outside WooCoommerce itself.

Also a working logic of both of them a pile-jumble with extra work and maybe not secure because protected info will be replaced after retrieving from database. But I want to block this info for all Wp-WooC requests-plugins for sure!

  1. Maybe WP-WooC support low-level filters direct at MySQL database? Does EACH query-select to DB have a USER_ID so it can be used for each query user right recognizing?

What method you suggest?