Agence Best Of Site
Forum Replies Created
-
Forum: Plugins
In reply to: [WooCommerce] Remove Add to Cart Buttons from Product PageFor 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
Forum: Plugins
In reply to: [WooCommerce] Remove Add to Cart Buttons from Product PageHello,
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!'; }