Published on Jan 5, 2020

How to change Home text and link in WooCommerce breadcrumbs

Sridhar Katakam

Oxygen comes with a handy WooCommerce Breadcrumb component that displays breadcrumbs like this:

You would most likely want to change the “Home” text to something like “Shop” and have it link to /shop/ instead of the site’s homepage.

Here’s how.

Install and activate Code Snippets.

Add a new Snippet.

Title: Change Home text and link in WooCommerce breadcrumbs

Code:

add_filter( 'woocommerce_breadcrumb_defaults', 'woo_change_breadcrumb_home_text' );
/**
* Change the breadcrumb home text from "Home" to "Shop".
* @param  array $defaults The default array items.
* @return array           Modified array
*/
function woo_change_breadcrumb_home_text( $defaults ) {
$defaults['home'] = 'Shop';
return $defaults;
}
add_filter( 'woocommerce_breadcrumb_home_url', 'woo_custom_breadrumb_home_url' );
/**
* Change the breadcrumb home link URL from / to /shop.
* @return string New URL for Home link item.
*/
function woo_custom_breadrumb_home_url() {
return '/shop/';
}

Save changes and activate.

Source: https://docs.woocommerce.com/document/customise-the-woocommerce-breadcrumb/

tagschevron-leftchevron-rightchainangle-rightangle-upangle-downfolder-omagnifiercrossmenuchevron-downarrow-right