Last active
November 22, 2016 19:15
-
-
Save jessepearson/43bfe62d080eeb7663ca9de13eaedb95 to your computer and use it in GitHub Desktop.
Function filters the price of products looking for "Free!" and replaces it with "$0.00"
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 // copy this line only if needed, usually it's not needed | |
| /** | |
| * Function filters the price of products looking for "Free!" and replaces it with "$0.00" | |
| * | |
| * @param string $price The price being passed | |
| * @param object $product The product we're looking at | |
| * @return string The filtered price | |
| */ | |
| function lets_replace_free_with_zeros( $price, $product ) { | |
| $price = str_ireplace( 'Free!', '$0.00', $price ); | |
| return $price; | |
| } | |
| add_filter( 'woocommerce_get_price_html', 'lets_replace_free_with_zeros', 100, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment