Breadcrumb

How do I display the breadcrumb?
To access the breadcrumb on the storefront, use the 
breadcrumb() function inside Twig files.
 It can be displayed by looping over each crumb like so:
<ul class="breabcrumb">
    {% for crumb in breadcrumb() %}
        <li class="crumb">
            {% if loop.last %}
                <span>{{ crumb.name }}</span>
            {% else %}
                <a href="{{ crumb.url }}">{{ crumb.name }}</a>
            {% endif %}
        </li>
    {% endfor %}
</ul>
 

How do I add something to the breadcrumb?
You can use the 
add() method to add a crumb:
\Aero\Store\Facades\Breadcrumb::add(function (\Aero\Store\Services\Breadcrumb $breadcrumb) {
    $breadcrumb->add(new \Aero\Store\Crumb('Name', '/url'));
});
You can provide a Closure that returns an 
\Aero\Store\Crumb instance instead if you need to defer until the breadcrumb is rendered.

How do I clear the breadcrumb?
You can use the 
clear() method to clear the crumbs:
\Aero\Store\Facades\Breadcrumb::clear();
 

How can I filter the breadcrumb?
You can provide a filter callback to remove unwanted crumbs, it should return 
true when a crumb should be kept and 
false otherwise:
\Aero\Store\Facades\Breadcrumb::setFilter(function ($crumb) {
    if ($crumb->getName() === 'Foo') {
        return false;
    }
    return true;
});
 

How can I display the request referrer?
By default, the product page breadcrumb is built based on the referrer.
For example, if a customer performs a search for "shirt" and then clicks on a listing result, the breadcrumb on the product page will be 
Home > Search for “shirt” > Casual Shirt.
To disable this functionality, use 
dontUseReferer():
\Aero\Store\Facades\Breadcrumb::dontUseReferer();
 

How can I disable the breadcrumb functionality?
There may be cases (such as an API) where the breadcrumb functionality should not use the request at all.
To do this, use 
dontUseRequest():
\Aero\Store\Facades\Breadcrumb::dontUseRequest();