Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Modify free price display in cart
<?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 );

This comment has been minimized.

Copy link

@radumg radumg commented Jun 27, 2016

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment