Hi There,
You should install and activate the Pro child theme first: https://theme.co/apex/forum/t/setup-how-to-setup-child-themes/57.
After that adding this custom code under functions.php
file locates in your child theme:
function bwl_breadcrumbs($crumbs){
global $post;
if( is_product() )
{
$indexToInsertAt = 2;//0=wpHome, 1=shopHome
//Add the first category this product belongs to
$curTerms = get_the_terms( $post->ID, 'product_cat' );
$crumbs = array_merge(
array_slice( $crumbs, 0, $indexToInsertAt, true ),
array(
array(
'type' => 'product_cat',
'url' => get_term_link( $curTerms{0}->term_id ),
'label' => $curTerms{0}->name
)
),
array_slice( $crumbs, $indexToInsertAt, null, true )
);
//If there are parent-categories, add breadcrumbs for those as well
$parentcats = get_ancestors($curTerms{0}->term_id , 'product_cat');
foreach($parentcats as $parentcat_id)
{
$crumbs = array_merge(
array_slice( $crumbs, 0, $indexToInsertAt, true ),
array(
array(
'type' => 'product_cat',
'url' => get_term_link( $parentcat_id ),
'label' => get_term_by( 'id', $parentcat_id, 'product_cat' )->name
)
),
array_slice( $crumbs, $indexToInsertAt, null, true )
);
}
};
return $crumbs;
}
add_filter('x_breadcrumbs_data', 'bwl_breadcrumbs');
Hope it helps