How To Change Single Product Page Title

To change the title of a single product page in WooCommerce, you can use the woocommerce_single_product_title filter hook in WordPress. Here’s an example code snippet that you can add to your theme’s functions.php file:

function custom_product_title( $title ) {
    $new_title = 'New Title Here';
    return $new_title;
add_filter( 'woocommerce_single_product_title', 'custom_product_title' );

This code replaces the default product title with a new title New Title Here. You can modify this code to change the title to any other text or variable that you want to display.

Once you have added this code, the new title will be displayed on the single product page. If you want to change the title for a specific product, you can modify the code to include a conditional statement based on the product ID or any other criteria.

Also, you can use the following way to change the title.

remove_action( 'woocommerce_single_product_summary','woocommerce_template_single_title', 5 );
add_action( 'woocommerce_single_product_summary', 'sgl_template_single_title', 99 );
function sgl_template_single_title() {
    the_title( '<h3 class="tt product_title entry-title">', '</h3>' );

Leave a Reply

Your email address will not be published. Required fields are marked *