WordPress.org

Forums

WooCommerce - excelling eCommerce
[resolved] Can I hide the price for un registered users? (3 posts)

  1. pyarasujal
    Member
    Posted 2 years ago #

    Can I hide the price for un registered users?

    http://wordpress.org/extend/plugins/woocommerce/

  2. ZjanPreijde
    Member
    Posted 2 years ago #

    Hi pyarasujal,

    Yes, you can. It's probably a little crude, but this is how you can do it.

    In your (child)themes directory, you should create a subdirectory structure like this :
    yourthemedir/woocommerce
    yourthemedir/woocommerce/loop
    yourthemedir/woocommerce/single-product
    Next copy
    yourplugindir/woocommerce/templates/loop/price.php
    to
    yourthemedir/woocommerce/loop/price.php
    and copy
    yourplugindir/woocommerce/templates/single-product/price.php
    to
    yourthemedir/woocommerce/single-product/price.php
    Edit both price.php files and add the following code between the <?php and ?> (just before the $global line is best in my opinion)
    if (!is_user_logged_in()) return;
    This will prevent prices showing up in the catalogue, search pages and single product page. If you're using widgets however, this will not stop showing the price, I think.

  3. Mimi8
    Member
    Posted 2 years ago #

    Hello ZjanPreijde

    I was looking for the same option, I tried your reply/suggestions and it worked!!!

    The only thing I cant figure out how to hide for logged out users is the add to cart, since when adding a product to the cart even if not logged in, it still displays the price, also on my homepage where I have sliders with the products.

    Do you have any suggestions there?

    Thank you in advanced.

    Mimi

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • WooCommerce - excelling eCommerce
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic