I'm building an ecommerce product page for a single product and am interested in including breadcrumbs. Since I only have a single product, how might I remove or hide the "Category" (currently labeled "Topicals") from the breadcrumb path:
Home > Topicals > Force of Nature - Mobility Balm
Here's a link to the page where this is visible.
/
Additionally, this page doesn't show up in my 'Pages' tab in my dashboard but is editable from my 'Templates' tab since I've built it as a Single Product template through Elementor. Why does this page not appear within the 'Pages' tab?
I'm pretty new to building websites (this being my first), I appreciate the patience. Thanks!
I'm building an ecommerce product page for a single product and am interested in including breadcrumbs. Since I only have a single product, how might I remove or hide the "Category" (currently labeled "Topicals") from the breadcrumb path:
Home > Topicals > Force of Nature - Mobility Balm
Here's a link to the page where this is visible.
https://zomatonics.com/product/mobility-balm/
Additionally, this page doesn't show up in my 'Pages' tab in my dashboard but is editable from my 'Templates' tab since I've built it as a Single Product template through Elementor. Why does this page not appear within the 'Pages' tab?
I'm pretty new to building websites (this being my first), I appreciate the patience. Thanks!
Try:
add_filter( 'woocommerce_get_breadcrumb', 'cwpai_modify_woocommerce_breadcrumbs', 10, 2 );
function cwpai_modify_woocommerce_breadcrumbs( $crumbs, $breadcrumb_class ) {
$new_crumbs = array();
foreach ( $crumbs as $key => $crumb ) {
// Keep the home link, parent categories, and product name
if ( $key == 0 || $key == count($crumbs) - 2 || $key == count($crumbs) - 1 ) {
$new_crumbs[] = $crumb;
}
}
return $new_crumbs;
}