pigsfoot Posted January 16, 2015 Share Posted January 16, 2015 HI, I have a wordpress site that uses WooCommerce and also WooThemes "Wish list" extension as part of a shop. I am wanting to hide the "add to cart" button when a price is 0.00 but retain the "Add to Wish List" button. I have already spoken to WooThemes and there responce is they do not offer coding assistance, i would have to employee someone to look at this for me.. I do have some code that kind of works... in that it does hide the "add to cart" button but it also hides the "add to wish list" button <?php /* * Swop the 'Free!' price notice and hide the cart with 'Subscription Item' in WooCommerce */ add_filter( 'woocommerce_variable_free_price_html', 'hide_free_price_notice' ); add_filter( 'woocommerce_free_price_html', 'hide_free_price_notice' ); add_filter( 'woocommerce_variation_free_price_html', 'hide_free_price_notice' ); function hide_free_price_notice( $price ) { 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 ); return 'Subscription Item'; } ?> I'm no programmer so i have no idea if this is a complex fix or something that maybe you guys on a forum can help out with. If it's out of the scope of general foum help i will have to post a job somewhere to see if i can get some help that way. Many Thanks... Quote Link to comment https://forums.phpfreaks.com/topic/293985-wordpress-woocommerce-question/ Share on other sites More sharing options...
programming2music Posted January 16, 2015 Share Posted January 16, 2015 (edited) I'm not familiar with Wordpress but where ever you're getting your price from I would do something like if ($price > 0) { // code to show button here } Edited January 16, 2015 by programming2music Quote Link to comment https://forums.phpfreaks.com/topic/293985-wordpress-woocommerce-question/#findComment-1503139 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.