catchlight
catchlight

Reputation: 63

Remove WooCommerce Product Page Title

I am trying to remove a page title from the top of Product page of my WooCommerce theme. (WooTheme's Homestore) to the right-hand side. I have managed to add the right-hand side page where I would like it but now need to remove the main page title.

I added the right-hand side page title like this in the functions.php

add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );

Here is a bit of the content-single-product.php template:

<?php
        /**
         * Hook: woocommerce_before_single_product_summary.
         *
         * @hooked woocommerce_show_product_sale_flash - 10
         * @hooked woocommerce_show_product_images - 20
         */
        do_action( 'woocommerce_before_single_product_summary' );
    ?>

    <div class="summary entry-summary">
        <?php
            /**
             * Hook: woocommerce_single_product_summary.
             *
             * @hooked woocommerce_template_single_title - 5
             * @hooked woocommerce_template_single_rating - 10
             * @hooked woocommerce_template_single_price - 10
             * @hooked woocommerce_template_single_excerpt - 20
             * @hooked woocommerce_template_single_add_to_cart - 30
             * @hooked woocommerce_template_single_meta - 40
             * @hooked woocommerce_template_single_sharing - 50
             * @hooked WC_Structured_Data::generate_product_data() - 60
             */
            do_action( 'woocommerce_single_product_summary' );
        ?>
    </div>

So where I'm confused is, how do I remove the page title when it's not even appearing within the tag?

The page title appears above the images at the moment and that's the title I'd like to remove using a hook or filter in my functions.php file.

Upvotes: 0

Views: 11450

Answers (2)

Imran Javed
Imran Javed

Reputation: 1

It is highly recommend, first you need to copy all the files and folder from your woocommerce plugin's folder -> woocommerce/templates folder to woocommerce folder in child-theme's folder yourtheme/woocommerce.

Now open the content-single-product.php file and paste this line of code just like as I did.

        remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
        /**
         * Hook: woocommerce_single_product_summary.
         *
         * @hooked woocommerce_template_single_title - 5
         * @hooked woocommerce_template_single_rating - 10
         * @hooked woocommerce_template_single_price - 10
         * @hooked woocommerce_template_single_excerpt - 20
         * @hooked woocommerce_template_single_add_to_cart - 30
         * @hooked woocommerce_template_single_meta - 40
         * @hooked woocommerce_template_single_sharing - 50
         * @hooked WC_Structured_Data::generate_product_data() - 60
         */
        do_action( 'woocommerce_single_product_summary' );

This way, you will remove the title on product page.

Upvotes: 0

Empty Brain
Empty Brain

Reputation: 627

To remove title for single product page. you can add this hook in content-single-product.php. just before the do_action.

//remove product title only
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );

As you are saying "The page title appears above the images". You can change it in theme css or theme woocommerce file. Anyway

All functions in the below list are binded in woocommerce_single_product_summary .

add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_title', 5 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_rating', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_price', 10 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_meta', 40 );
add_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_sharing', 50 );

Upvotes: 6

Related Questions