Created
May 31, 2016 22:11
-
-
Save bekarice/fea75fecbde280c158398011ffc9f839 to your computer and use it in GitHub Desktop.
Modify free price display in cart
This file contains 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 // only copy if needed | |
/** | |
* Change cart price display for free products | |
* | |
* @param string $price_html the price display html | |
* @param \WC_Product | |
* @return string - updated pricing html | |
*/ | |
function sv_wc_free_cart_price( $price_html, $product ) { | |
if ( 0 === (int) $product->get_price() ) { | |
$price_html = 'No charge!'; | |
} | |
return $price_html; | |
} | |
add_filter( 'woocommerce_cart_product_price', 'sv_wc_free_cart_price', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi Beka, many thanks for the snippet, works great for the cart page !
Any idea how/which hook to use in order to do the same for the final checkout page ? Still displays a 0 price.