# Price Label Field per Product ("per m²", "per month")

> Adds a field to each product for a short label shown after its price, such as "per m²", "per person" or "per night".

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

## Code

```php
add_action( 'woocommerce_product_options_pricing', function () {
    global $product_object;

    woocommerce_wp_text_input( array(
        'id'          => '_wpide_price_label',
        'label'       => 'Price label',
        'placeholder' => 'per m²',
        'value'       => $product_object instanceof WC_Product ? $product_object->get_meta( '_wpide_price_label' ) : '',
    ) );
} );

add_action( 'woocommerce_admin_process_product_object', function ( $product ) {
    // phpcs:ignore WordPress.Security.NonceVerification -- WooCommerce verifies the product save nonce.
    if ( isset( $_POST['_wpide_price_label'] ) ) {
        $product->update_meta_data( '_wpide_price_label', sanitize_text_field( wp_unslash( $_POST['_wpide_price_label'] ) ) );
    }
} );

add_filter( 'woocommerce_get_price_html', function ( $html, $product ) {
    if ( '' === $html ) {
        return $html;
    }

    $id    = $product->get_parent_id() ? $product->get_parent_id() : $product->get_id();
    $label = get_post_meta( $id, '_wpide_price_label', true );

    return '' === $label ? $html : $html . ' <span class="wpide-price-label">' . esc_html( $label ) . '</span>';
}, 30, 2 );
```

## Notes

The label appears wherever the price is shown, and variations use their parent product's label.

## How to use it

Install the free WPIDE plugin (https://wordpress.org/plugins/wpide/), find "Price Label Field per Product ("per m²", "per month")" 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/
