Documentation

Append Trademark After The Product Title

You might want to dynamically add a Trademark symbol or something else after the product or variation title. If that’s the case, the below code snippet can be used to get it done:

/**
 * Append TM after the product title
 *
 * @param string $title
 * @param int $id
 *
 * @return string $title
 */
function iconic_update_post_title( string $title, int $id ): string {
	$allowed_post_ids = array( 1, 2, 3 );
	if ( in_array( $id, $allowed_post_ids ) ) {
		if ( 'product' === get_post_type( $id ) || 'product_variation' === get_post_type( $id ) ) {
			return $title . "TM";
		}
	}

	return $title;
}

add_filter('the_title', 'iconic_update_post_title', 10, 2);

Are you using WooCommerce Show Single Variations yet?

Start your 14-day free trial right now and get instant access to the features described in this article.

or learn more

Was this helpful?

Please let us know if this article was useful. It is the best way to ensure our documentation is as helpful as possible.

WooCommerce Show Single Variations

WooCommerce Show Single Variations

Not got the plugin yet? Get instant access right now, free for 14 days.

or learn more

Still need help?

If you haven't found what you're looking for in our documentation, please contact support.

Get Support