Created
June 26, 2025 09:58
-
-
Save shameemreza/4add4af40cb73104f18e77eea54e132d to your computer and use it in GitHub Desktop.
Hides the product price on the frontend if it's set to zero in WooCommerce.
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
| /** | |
| * Hide price if it's set to zero | |
| */ | |
| function a8c_hide_zero_prices( $price, $product ) { | |
| if ( '' === $product->get_price() || 0 == $product->get_price() ) { | |
| $price = ''; | |
| } | |
| return $price; | |
| } | |
| add_filter( 'woocommerce_get_price_html', 'a8c_hide_zero_prices', 10, 2 ); |
Author
shameemreza
commented
Jun 26, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment