Forum Replies Created

Viewing 1 replies (of 1 total)
  • Forum: Plugins
    In reply to: [WooCommerce] Hide Prices

    OK thanks to all!!

    Its work for me the following:
    ( paste in the function.php )

    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')). '">Accede</a> o <a href="'.site_url('/wp-login.php?action=register&redirect_to=' . get_permalink()).'">Regístrate</a> para ver precios!'.remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart' ).remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 ).remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 ).remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
    }

    this hide price and add to cart button and all prices in site.. if I dont login of course..

Viewing 1 replies (of 1 total)