skip to Main Content

How to Change the Breadcrumbs Shop Link

By default the shop link added in the breadcrumbs is based on your defined Shop page under the WooCommerce settings. It is possible to change the link by changing the shop page in WooCommerce but if you only want to change the breadcrumbs only then you need to use some code. Note: This code will only work when using the theme’s breadcrumbs. If you are using Yoast or another SEO plugin for the breadcrumbs then the code wouldn’t work, you would need to instead modify the plugin settings or use code to modify the plugin.

/**
 * Change breadcrumbs shop link.
 *
 * @link https://total.wpexplorer.com/docs/snippets/breadcrumbs-custom-shop-link/
 */
add_filter( 'wpex_breadcrumbs_trail', function( $trail ) {
    if ( is_array( $trail ) && isset( $trail['shop'] ) ) {
        $shop_title = 'YOUR CUSTOM TEXT';
        $shop_url = 'YOUR_CUSTOM_URL';
        $class = 'trail-shop';
        if ( is_callable( [ 'WPEX_Breadcrumbs', 'get_crumb_html' ] ) ) {
            $trail['shop'] = WPEX_Breadcrumbs::get_crumb_html( $shop_title, $shop_url, $class );
        }
    }
    return $trail;
}, 50 );
All PHP snippets should be added via child theme's functions.php file or via the Code Snippets Plugin (or alternative plugin)
Back To Top