WordPress.org

Ready to get started?Download WordPress

Forums

Hide Price for variations until a variation has been selected (1 post)

  1. iwednesday
    Member
    Posted 3 months ago #

    Hi,

    Is there a way to hide the price until a variation has been selected?

    I have seen code to disable price unless the user is logged in .

    How could i modify such code?

    add_filter('woocommerce_get_price_html','members_only_price');
    function members_only_price($price){
    if(is_user_logged_in() ){
        return $price;
    }
    else return '<a href="' .get_permalink(woocommerce_get_page_id('myaccount')). '">Login</a> or <a href="'.site_url('/wp-login.php?action=register&redirect_to=' . get_permalink()).'">Register</a> to see price!';
    }

    Any help would be great thanks

Reply

You must log in to post.

About this Topic