Created
January 26, 2019 10:16
-
-
Save vishalck/610bd8df57311c0f398ca238830e307c to your computer and use it in GitHub Desktop.
How to Hide Prices on WooCommerce Shop and Category Pages
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Snippet 1: Hide prices on all categories | |
* Created by: Tyche Softwares | |
*/ | |
function tyches_hide_prices_on_all_categories( $price, $product ) { | |
if ( is_tax() ) { | |
return ''; // Empty string = no price! | |
} | |
return $price; | |
} | |
add_filter( 'woocommerce_get_price_html', 'tyches_hide_prices_on_all_categories', 10, 2 ); | |
/** | |
* Snippet 2: Hide prices on shop pages | |
* Created by: Tyche Softwares | |
*/ | |
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 ); // yes, that's it! |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment