• Hello,

    Is there a possibility to remove the Home link from the breadcrumbs only on the woocommerce pages (Shop)?

    Now: Home / Shop / Category / Product

    Wanted: Shop / Category / Product

    It must remain on the website with “Home”, only with Woocommerce webshop without.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author John Havlik

    (@mtekk)

    Your best bet is to use the bcn_after_fill action to selectively remove the home breadcrumb from the trail. This article provides an example on how to do this: https://mtekk.us/archives/guides/conditionally-remove-home/ You should just need to change the conditional from is_page() to the appropriate woocommerce conditional (I assume there is something like is_woocommerce() or something like that)

    Thread Starter robdieffenbach

    (@robdieffenbach)

    The code below is the solution.
    Second part adds Shop / to the search page

    
    //Removes Home from Woocommerce
    add_action('bcn_after_fill', 'foo_pop');
    function foo_pop($trail)
    {
    	if(is_woocommerce()|| is_cart() || is_checkout() || is_account_page() )
    	{
    		array_pop($trail->breadcrumbs);
    	}
    }
    //Add's shop to Woocommerce search page's.
    add_action('bcn_after_fill', 'my_static_breadcrumb_adder');
    function my_static_breadcrumb_adder($breadcrumb_trail)
    {
    	if( is_search() && is_shop())
    	{
        	$breadcrumb_trail->add(new bcn_breadcrumb('SHOP_BREADCRUMB_TEXT', NULL, array('home'), 'SHOP_URL', NULL, true));
        }
    }
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Remove Home’ is closed to new replies.