• Resolved soling4

    (@soling4)


    Hi guys, sorry but I didn’t know where to post this.

    I have added the following code to hide product prices for logged out users:

    add_action( 'init', 'hide_price_add_cart_not_logged_in' );
    
    function hide_price_add_cart_not_logged_in() {
    	if ( ! is_user_logged_in() ) {
    	 add_action( 'woocommerce_single_product_summary', 'print_login_to_see', 31 );
    	 add_action( 'woocommerce_after_shop_loop_item', 'print_login_to_see', 11 );
    	}
    }
    
    function print_login_to_see() {
    	echo '<a href="' . get_permalink(wc_get_page_id('myaccount')) . '">' . __('Login to see price', 'theme_name') . '</a>';
    }

    And it worked just fine, however prices are still showing up in google image search results as you can see in the screenshot:

    https://i.ibb.co/xXnRbDj/ss.png

    What can I do about this? I really need for people to not be able to see prices without an account. Is anyone able to help?

    Much appreciated

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    Hi there ??

    While checking on the internet, I found an article that can help you with that. Here is the link:

    https://www.businessbloomer.com/woocommerce-hide-product-prices-from-google/

    I hope that helps ??

    Thread Starter soling4

    (@soling4)

    Thank you for your message.

    Actually that is the code that I found and added a few days ago, however I’m not sure how long should I wait to see the results of this. I know google indexing is something that takes time but… I was also wondering if the prices that are showing there already are going to disappear, meaning, this will not only work for the future added products correct?

    Also, the screenshot that they show where price is showing on google is not the same that I showed (google image search result), do you think this will work the same way?

    Mirko P.

    (@rainfallnixfig)

    Hi @soling4,

    According to the article, what that snippet is supposed to do is hide WooCommerce product prices from Google search results. I assume that if it’s working you will no longer see your product prices in Google search within a few days/weeks.

    It seems that Google crawling bots are indexing sites from as little as 4 days and up to 6 months. I’d advise reaching out to the Google support team that is best positioned to answer your question.

    Thanks!

    Plugin Support Gabriel – a11n

    (@gabrielfuentes)

    We’ve not seen any activity on this thread for a while, so I’m marking this thread as resolved.

    Hopefully, you were able to find a solution to your problem! If you have further questions, please feel free to open a new topic.

    Cheers!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Hiding product price’ is closed to new replies.