Change the Shop page title
You know that WooCommerce generates the Shop page automatically, you only need to select what page to use in the settings.
Also, it does not matter what title your page has, it will still use the title “Product – Your site name”.
How to change it?
Add this code at the end of the file functions.php in wp-content/themes/your-child-theme-name/:
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Change the Shop archive page title. | |
* @param string $title | |
* @return string | |
*/ | |
function wc_custom_shop_archive_title( $title ) { | |
if ( is_shop() && isset( $title['title'] ) ) { | |
$title['title'] = 'My Title'; | |
} | |
return $title; | |
} | |
add_filter( 'document_title_parts', 'wc_custom_shop_archive_title' ); |
This code will only work on the Shop page and won’t affect any other page in your website.
thanks. works like a charm. i edited it, so it return the actual page title of the shop page defined in wc:
even a bit nicer:
Hi there!
Thanks for the tweak 🙂
how to change woocommers button text add to cart to Shop now
Hi Nikul,
You can find how to do that here: https://docs.woocommerce.com/document/change-add-to-cart-button-text/
im new with code but where do you change the name , my shops default has Products and another line saying add new products here. thanks
Hi Troy,
You just need to change the name of the Shop page in Pages > All Pages. That one will be used.