[ad_1]
Hi @0alex0,
I wish I could assist, however the breadcrumbs integration is limited to the most basic scenarios, and I am unable to give support for third-party plugins that are responsible for showing the breadcrumbs.
If you could provide me the name of the breadcrumbs plugin you are using or the URL of your website, I would be happy to send you a link to the breadcrumbs API documentation. This way you could filter the breadcrumbs link to the vendor page instead of the brand attribute term.
Thread Starter
0alex0
(@0alex0)
Hi @mbis,
Thanks for your prompt response. Really appreciated. I am currently using standard WooCommerce breadcrumbs.
- This reply was modified 36 minutes ago by 0alex0.
Hi @0alex0
The code should be as follows:
function pm_adjust_product_breadcrumbs($crumbs, $breadcrumb) {
global $post;
if(!empty($post) && $post->post_type == 'product' && function_exists('dokan')) {
$vendor_id = $post->post_author;
$vendor = dokan()->vendor->get($vendor_id);
$store_name = get_user_meta($vendor_id, 'dokan_store_name', true);
$store_url = $vendor->get_shop_url();
// Change the link and the title of second crumb
$crumbs[1] = array(
$store_name,
$store_url
);
}
return $crumbs;
}
add_filter('woocommerce_get_breadcrumb', 'pm_adjust_product_breadcrumbs', 100, 2);I am not certain what crumb should be affected, but you can change it by adjusting the array index in $crumbs[1] to eg. $crumbs[2]
Thread Starter
0alex0
(@0alex0)
Working perfectly with that code! I just needed to adjust the array index to “2” as you suggested.
Thank you so much for your help!
