If you didn’t like showing a $0.00 and prefer it with the text “FREE” for the free products, you may use below code snippet.
Below is the code you may copy and paste at the bottom of functions.php where you can access it through > Theme File Editor > functions.php.
function tt_product_price_free( $price, $product ) {
if ( $product->get_price() == 0 ) {
if ( $product->is_on_sale() && $product->get_regular_price() ) {
$regular_price = wc_get_price_to_display( $product, array( 'qty' => 1, 'price' => $product->get_regular_price() ) );
$price = wc_format_price_range( $regular_price, __( 'FREE', 'woocommerce' ) );
} else {
$price = '' . __( 'FREE', 'woocommerce' ) . '';
}
}
return $price;
}
add_filter( 'woocommerce_get_price_html', 'tt_product_price_free', 10, 2 ); Check out this Live Demo
1. The Origin and The Meaning of Startup The word "start" refers to the beginning…
=== #1: AI Chatbot === 1. ChatGPTGet Started here: https://chat.openai.comChatGPT, one of the most significant language…
Dashicons is the official icon font since WordPress admin as of 3.8. https://developer.wordpress.org/resource/dashicons/ However, it…
Recently I had a great coffee chat with my old pal - Wei Ming, founder…
Sometimes there is a need for a custom new order status for WooCommerce orders such…
Here is a list of logo branding ideas for your next business or startup: …