Forum Replies Created

Viewing 2 replies - 16 through 17 (of 17 total)
  • For add a link button product add this :
    <a style="clear:both; display:block;" class="button" href="'.get_permalink( $product->id ) .'">Lire plus</a>

    before “;” in the last line
    EX :

    function remove_loop_button(){
    if(is_user_logged_in()){}else
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
    }
    add_action('init','remove_loop_button');
    
    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! <a>id ) .'">Lire plus</a>';
    
    }

    Enjoy ! MIKE

    Hello,
    For hidden price and button (add to cart) copy paste this code in function.php themplate.

    function remove_loop_button(){
    if(is_user_logged_in()){}else
    remove_action( 'woocommerce_after_shop_loop_item', 'woocommerce_template_loop_add_to_cart', 10 );
    remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_add_to_cart', 30 );
    }
    add_action('init','remove_loop_button');
    
    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!';
    
    }
Viewing 2 replies - 16 through 17 (of 17 total)