• Resolved romanhugo

    (@romanhugo)


    i want to use this dynamic link for my button made with elementor. Please tell me how to get this link for the button so that it is bound to the current user.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello @romanhugo,

    You can get a dynamic store URL using this below function.
    dokan_get_store_url( dokan_get_current_user_id()

    Thanks,

    Thread Starter romanhugo

    (@romanhugo)

    URL of the store is recorded in the database as user_nicename, but when I want to display this field, it shows the sellers login.

    I dont know how i can use your function. Sorry…

    Hello @romanhugo ,

    Here is an example code by which you can pull the store URL in the product page:

    function seller_url_on_single_product() {
    
        global $product;
        $seller = get_post_field( 'post_author', $product->get_id());
        $author  = get_user_by( 'id', $seller );
        $store_url = esc_url( dokan_get_store_url( $author->ID ) );
            
        ?>
            <span class="details">
                <a href="<?php echo $store_url; ?>">Return to vendor store</a>
            </span>
        <?php
            
    }

    The only requirement you have is the $seller-id which is basically ther user ID number that you have for each user. Now, there are tons of different ways to get access to the user IDs in WordPress. You can check this article to have some ideas on it – https://rudrastyh.com/wordpress/get-user-id.html

    I hope these are all the information you need to understand how to get access to the store url.

    Thank you ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom button of visit store’ is closed to new replies.