• hello! first timer here!

    when i create a product group i remove the included products from the product categories in the backend otherwise they’ll show up right next to the grouped product but now the breadcrumb hiearchi for when viewing one of those grouped products is all screwy.

    Is there some good way of going about this?

    Image detailing and showing

    • This topic was modified 7 years, 6 months ago by premier69. Reason: added screenshot
Viewing 1 replies (of 1 total)
  • With the help of below hook sample code you can customize breadcrumb of product page.

    function woo_custom_breadcrumbs_trail_add_product_categories ( $trail ) {
    if ( ( get_post_type() == ‘product’ ) && is_singular() ) {
    global $post;
    $taxonomy = ‘product_cat’;
    $terms = get_the_terms( $post->ID, $taxonomy );
    $links = array();
    if ( $terms && ! is_wp_error( $terms ) ) {
    foreach ( $terms as $c ) {
    $parents = woo_get_term_parents( $c->term_id, $taxonomy, true, ‘, ‘, false, array( $c->term_id ) );
    if ( $parents != ” ) {
    $parents_arr = explode( ‘, ‘, $parents );
    foreach ( $parents_arr as $p ) {
    if ( $p != ” ) { $links[] = $p; }
    }
    }
    }
    $links[] = $trail[‘trail_end’];
    array_splice( $trail, 1, count( $trail ) – 1, $links );
    }
    }
    return $trail;
    }
    add_filter( ‘woo_breadcrumbs_trail’, ‘woo_custom_breadcrumbs_trail_add_product_categories’, 10 );

Viewing 1 replies (of 1 total)
  • The topic ‘woocommerce – Grouped products and breadcrumb’ is closed to new replies.