dementian27
dementian27

Reputation: 63

How do I remove the "Home" link from the Woocommerce breadcrumb?

Right now on my woocommerce shop the breadcrumb reads "Home > Shop > Product Category > Product > etc".

I Would like to remove the home link so the breadcrumb trail starts with "Shop" as the first link.

Thanks!

Upvotes: 3

Views: 6263

Answers (3)

Solanki Nikita
Solanki Nikita

Reputation: 1

function remove_home_from_breadcrumbs($defaults) {
    $defaults['home'] = '';
    return $defaults;
}
add_filter('woocommerce_breadcrumb_defaults', 'remove_home_from_breadcrumbs');

Upvotes: 0

19h47
19h47

Reputation: 78

You can also directly pass an empty string to the woocommerce_breadcrumb function.

<?php woocommerce_breadcrumb( array( 'home' => '' ) ); ?>

The function take an home argument and if this argument is empty, the home link isn't added, see: https://github.com/woocommerce/woocommerce/blob/master/includes/wc-template-functions.php#L2237

Upvotes: 1

Mahesh Patel
Mahesh Patel

Reputation: 113

add_filter('woocommerce_breadcrumb_defaults', function( $defaults ) {
    unset($defaults['home']); //removes home link.
    return $defaults; //returns rest of links
});

the above code goes to your functions.php.

Upvotes: 6

Related Questions