[Resolved] Change Page Title for Woocommerce Shop Page

Home Forums Support [Resolved] Change Page Title for Woocommerce Shop Page

Home Forums Support Change Page Title for Woocommerce Shop Page

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #1269816
    Chris

    Hey guys,

    Just installed a takeout menu for a restaurant client to help them get more moneys during the pandemic.

    Everything is looking good and your theme plays very nicely with a cool plugin called Woocommerce Product Table to get a nice restaurant-style single page menu.

    I have one issue I would like to change:

    On the main shop page it is showing the title as “Products” and the original page title that is set in the Pages section has been pushed down into the body of the page.

    I would like Products to go away and be replaced by the title that is set. It’s strange, because Products is not listed anywhere on the settings. I feel like it’s buried in Woocommerce somewhere and I don’t know how to turn it off.

    Thanks for your help!
    Chris

    #1270117
    David
    Staff
    Customer Support

    Hi there,

    Shop pages ( like the Blog and other archives ) don’t have a ‘content title’ like posts and pages do, which is what the Header Elements {{post_title}} template tag displays. Instead of displaying nothing GP displays ‘Products’.

    You will need to exclude the Product Archive from your current header element and create another Header Element specifically for the Product Archive and add the title as HTML eg. <h1>My Title</h1>

    #1270295
    Chris

    Thanks for the response, David.

    How does one go about doing that? Will I need to make a new header element that pertains to Woo specific pages? It seems pretty clear that the global header element is not functioning for the shop page, but the order (my name for cart) and checkout pages are working fine.

    Will this also fix the issue with the post title being pushed down into the body?

    #1270302
    David
    Staff
    Customer Support

    Edit your existing Global header element and on the Display Rules > Exclusions – add Product Archive.

    Then create a new Header Element using the same settings as your global one accept the content will be:

    <h1>add your title... </h1>

    And the display rules > locations will be only Product Archive.

    #1270396
    Chris

    Awesome, all set! Thanks again.

    #1270455
    David
    Staff
    Customer Support

    You’re welcome

    #2483752
    Scott

    Sorry for resurrecting an old post, but where are you adding the:

    <h1>add your title... </h1>

    And just to be clear, when you say add a new header element you’re NOT talking about the hero header right?

    #2483815
    Ying
    Staff
    Customer Support

    Hi Scott,

    You can do so with either header element (classic editor) or a block element – page hero (block editor).

    #2483841
    Scott

    I used to do this with a snippet two years ago. Sadly it’s not working anymore.

    function shop_title( $title ) {
    
        if ( is_shop() && isset( $title['title'] ) ) {
            $title['title'] = apply_filters( 'the_title', get_the_title( get_option( 'woocommerce_shop_page_id' ) ) );
        }
    
        return $title;
        
    }
    add_filter( 'document_title_parts', 'shop_title' );
    

    It’s just an old snippet I saved and haven’t needed it until now … wish it still worked.

Viewing 9 posts - 1 through 9 (of 9 total)
  • You must be logged in to reply to this topic.