Site logo

Archived topic

Woocommerce shop page set to the homepage on a subdomain

10 replies · Started by Scott on January 2, 2023

Viewing posts 1–11 of 11

I’ve moved my WooCommerce store to a subdomain. Since it doesn’t require a “homepage” itself I set the “homepage” setting in the customizer to be the shop page.

I’ve got the basic structure set but one thing I can’t figure out is why the Title of the shop page doesn’t show?

If I change the homepage to any other page the title of the page shows.

Thoughts on how to get the Title to show?

Hi Scott,

1. To show to page title of shop, go to customizer > layout > WooCommerce, check the Display page title box.

2. GP has no control over the breadcrumbs, it's added by Woocommerce, so I guess Woocommerce doesn't add breadcrumbs to the homepage.

Hello,

The display page title box is checked and still no title on the shop page when it’s set as the homepage. The breadcrumb issue isn’t an issue much since breadcrumbs don’t usually appear on the homepage of any site. I mentioned that part in passing.

Issue with the title though is still ongoing.

Sure. Info in private field.

May we know the login link as well?

Sorry! In the private area

I see.

You need to add page-hero-title to the class list of your Block Element - Page Hero's Headline Block for the title.

Adding Custom Classes: https://wordpress.com/support/wordpress-editor/adding-additional-css-classes-to-blocks/

Then, add this snippet:

add_filter( 'generate_dynamic_element_text', function( $text, $block ) {
    if ( !is_admin() && is_shop() && ! empty( $block['attrs']['className'] ) && 'page-hero-title' === $block['attrs']['className'] ) {
        $text = 'Shop';
    }

    return $text;
}, 10, 2 );

Adding PHP: https://docs.generatepress.com/article/adding-php/#code-snippets

This adds the Shop Title to your Headline Block if the page is the Shop Page.

Sweet! I’ll work on that now. I’ve never done that before so this should be a good learning experience.

Yes, Hooks are indeed great to learn for WordPress development. Let us know how it goes! :)

Jeez that was easy!

This is 100% why I’ve migrated all the sites I manage to GP. Simply outstanding support!

Thank you so much.

This archived topic is closed to new replies.