Hide Add To cart Button in WordPress Woocommerce

I am trying to hide Addtocart button in all pages when user is not login in the site.
Also, I used this code for hiding the Price and AddtoCart.

if (!is_user_logged_in()) {
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
    remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10);

    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10);
   /*********** REMOVE PRICE FROM ALL PLACES *******/
    add_filter( 'woocommerce_variable_sale_price_html', 'theme_remove_prices', 10, 2 );
    add_filter( 'woocommerce_variable_price_html', 'theme_remove_prices', 10, 2 );
    add_filter( 'woocommerce_get_price_html', 'theme_remove_prices', 10, 2 );

function theme_remove_prices( $price, $product ) {
    $price = '';
    return $price;

but unfortunately it did not work in all situations.
I need to hide AddtoCart in these pages which I showed in the images.

enter image description here

and this one

enter image description here

I was wondering If you could help me to solve this problem.
Thanks in advance.

How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum