NO BUG: Breadcrumbs (WooCommerce) shows "page No" [SOLVED]

Element “Breadcrumbs (WooCommerce)” shows “Page No” as the last page:
image

It’s a page number. So when I change the page to eg. “36”, it shows “Page 36”:

The breadcrumb should’t show the page No. :slight_smile:

Hi Leo,
Thanks so much for your report!

That’s the native WooCommerce Breadcrumbs function woocommerce_breadcrumb(). You’ll get the same result with any other theme, such as the Woo Storefront theme:

Best regards,
timmse

Thanks I didn’t knew it. :slight_smile:
So I’ve written a small code to solve this, if someone need that too (don’t forget to translate the 'page ' string to your Wordpress language):

add_filter('woocommerce_get_breadcrumb', 'remove_page_crumb', 10, 2);
function remove_page_crumb($crumbs, $that) {
  $lastIndex = count($crumbs) - 1;
  if ($lastIndex >= 0 && (strpos(strtolower($crumbs[$lastIndex][0]), 'page ') === 0)) {
    array_pop($crumbs);
  }
  return $crumbs;
};
2 Likes