Skip to content

Early-bird lifetime licence: $199 once, for the first 200 buyers only. See the offer

“Free” instead of €0.00

Products that cost nothing show “Free” instead of €0.00.

  • Type PHP
  • Runs Everywhere (runs as WordPress loads)
  • Needs WooCommerce
  • Category WooCommerce
  • Tested with WordPress 7.1, WooCommerce 11.1
PHP
<?php

add_filter(
	'woocommerce_get_price_html',
	static function ( $html, $product ) {
		if ( '' !== $product->get_price() && 0.0 === (float) $product->get_price() && ! $product->is_type( 'variable' ) ) {
			return '<span class="amount">' . esc_html__( 'Free!', 'woocommerce' ) . '</span>';
		}
		return $html;
	},
	10,
	2
);

In these packs

Move your snippets over this afternoon.

Importing changes nothing until you switch over, and your old shortcodes keep working.