Hide vendor’s Shop page

There is no such option to unset vendor shop page, as our vendor shop page is nothing but taxonomy page, like catgeory, tax. however, you can stop the vendor and customer from accessing the page by directing users from the vendor’s shop page to site’s shop page. Hence, the customer/vendor will always be directed to the site’s shop page, when they will click on the vendor’s name. For this you have to follow this steps : –

  • Hide the “My Shop” tab from vendor dashboard using the following code so that vendor won’t be able to see the shop page.
add_filter( 'mvx_vendor_dashboard_header_nav', 'filter_mvx_vendor_dashboard_header_nav', 10, 1 );{
unset($header_nav['shop-link']); //remove Vendor Shop Link
return $header_nav;
}
  • Add this code snippet in the child theme’s function.php as this will redirect the customer to site’s shop page.
function my_page_template_redirect()
{
if( is_tax( 'dc_vendor_shop' ) )
{
$shop_page_url = get_permalink( woocommerce_get_page_id( 'shop' ) );
wp_safe_redirect($shop_page_url);
exit();
}
}
add_action( 'template_redirect', 'my_page_template_redirect', 999 );

Leave a Reply