# Show "Free" Instead of a Zero Price

> Displays the word "Free" for products priced at 0 instead of showing $0.00.

- Type: PHP
- Runs: Run everywhere
- Category: [WooCommerce](https://wpide.com/library/category/woocommerce/)
- Requires: WooCommerce
- Tags: woocommerce, price, free
- Author: WPIDE Team
- Installs: 0
- Updated: 2026-10-28
- Page: https://wpide.com/library/woo-free-price-label/

## Code

```php
add_filter( 'woocommerce_get_price_html', function ( $html, $product ) {
    $label = 'Free'; // Shown instead of a zero price.

    if ( ! $product instanceof WC_Product || $product->is_type( array( 'variable', 'grouped' ) ) ) {
        return $html;
    }

    if ( '' !== $product->get_price() && 0.0 === (float) $product->get_price() ) {
        return '<span class="amount wpide-free-price">' . esc_html( $label ) . '</span>';
    }

    return $html;
}, 10, 2 );
```

## Notes

Change $label to any wording you like, for example "Free download".

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Show "Free" Instead of a Zero Price" in its snippet library and add it in one click; or create a new PHP snippet in WPIDE (or any code snippets plugin) and paste the code above. More snippets: https://wpide.com/library/
