How to include vendor name in Permalinks, Dokan?How to include vendor name in Permalinks, Dokan?

Hello guys how are you? Welcome back to my blog therichpost.com. Guys today in this post, I will tell you How to include vendor name in Permalinks, Dokan?

Guys if you are new in  WordPress or in WooCommerce then please check the below links for some good tutorials:

  1. WooCommerce Hooks
  2. WordPress Tricks
  3. WordPress Hooks
  4. Dokan

Here is the working steps and please follow carefully:

In Dokan, you can include the vendor name in permalinks by modifying the vendor store URL structure. Here’s how you can do it:

1. Enable Vendor Store URL with Vendor Name

Dokan automatically assigns a store URL for each vendor. To ensure the vendor name appears in the permalink:

  • Navigate to Dokan → Settings → General.
  • Find the “Store URL” option and ensure it uses the vendor’s name.

2. Customize Permalinks for Vendor Products

If you want to include the vendor name in product permalinks:

  1. Go to WordPress Dashboard → Settings → Permalinks.
  2. Under Product Permalinks, you may need to select “Custom Base” and add /vendor/%vendor_name%/%product_name%/.
  3. Use a plugin like Permalink Manager Lite to further refine the structure.

3. Modify Permalinks Using Code (Advanced)

If you want deeper customization, you can add the vendor name dynamically using custom functions:

function custom_dokan_vendor_permalink($permalink, $post) {
    if ($post->post_type == 'product') {
        $vendor_id = get_post_field('post_author', $post->ID);
        $vendor    = dokan()->vendor->get($vendor_id);
        if ($vendor) {
            $vendor_slug = $vendor->get_shop_slug();
            $permalink = home_url("/vendor/{$vendor_slug}/" . $post->post_name);
        }
    }
    return $permalink;
}
add_filter('post_type_link', 'custom_dokan_vendor_permalink', 10, 2);

Would you like help implementing this on your site? 🚀 Feel Free to comment below.

Ajay

Thanks

By therichpost

Hello to all. Welcome to therichpost.com. Myself Ajay Malhotra and I am freelance full stack developer. I love coding. I know WordPress, Core php, Angularjs, Angular 19, MedusaJs, Next.js, Bootstrap 5, Nodejs, Laravel, Codeigniter, Shopify, Squarespace, jQuery, Google Map Api, Vuejs, Reactjs, Big commerce etc.