1. Home
  2. Docs
  3. Third party plugins & themes
  4. Dokan

Dokan

Permalink Manager is compatible with Dokan specific pages. It includes, eg. vendor dashboard and settings page.

It is worth to mention that you can make Permalink Manager include store/vendor name in WooCommerce product permalinks. This feature is not by default included, but you can add it with a simple snippet.

How to add store name in Dokan’s products’ permalinks?

First of all you will need to add below code to functions.php file in (child) theme directory. This would allow Permalink Manager to detect a new permastructure tag (%store%) for new product permalinks.

/**
 * Use %store% in Products' permastructure settings
 */
function pm_dokan_store_field($default_uri, $native_slug, $post, $slug, $native_uri) {
    // Do not affect native URIs
    if($native_uri == true || empty($post->post_type) || $post->post_type !== 'product') { return $default_uri; }
 
    if(strpos($default_uri, '%store%') !== false) {
        $store_name = get_user_meta($post->post_author, 'dokan_store_name', true);
        $default_uri = str_replace('%store%', sanitize_title($store_name), $default_uri);
    }
 
    return $default_uri;
}
add_filter('permalink_manager_filter_default_post_uri', 'pm_dokan_store_field', 3, 5);

Now, after you added the new snippet, you can place %store% tag inside permastructure settings for products.

Please check out this article, if you would like to better understand what the permastructures are. The store/vendor name will be automatically added to new product permalinks. If you would like to use the new permalink format also for old permalinks, you will need to regenerate them.