How to set “Free” label

Another example about how simple is to customise TheCartPress is how to set Free label for products with price 0.

TheCartPress uses a function tag, called “tcp_get_the_price_label” to return ( and display) the price using currency layout. This function has a filter called tcp_get_the_price_label.

The code to copy in your function.php would be:

add_filter( 'tcp_get_the_price_label', 'my_tcp_get_the_price_label', 10, 3 );

function my_tcp_get_the_price_label( $label, $post_id, $price ) {
	if ( $price == 0 ) return '<span class="tcp_free">' . __( 'Free', 'tcp' ) . '</span>';
	return $label;
}