• Resolved Fabricio10

    (@fabriciobarros10)


    I need to take some open stores off the page that lists stores for customers not to see it./store-listing/

    This store will be hidden and it will be possible to enter only by direct link.

    I thought about hiding it with Css but then it would continue to be filtered and the stores closed message would not appear.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello @fabriciobarros10,

    If you want to hide some stores you need to disable the selling ability of the vendor from wp-admin–>Dokan–>vendors. Use the toggle button and disable the vendor. Those vendors will not be available on the store listing page

    I hope this will help you with the requirement you have

    Thread Starter Fabricio10

    (@fabriciobarros10)

    @roshni07 I think you didn’t understand. I don’t want to deactivate the store because it will still be working, but access will only be via the url.

    I just don’t want it to appear in the store listing and I don’t want to use css display: none to do this.

    Hello @fabriciobarros10 ,

    If you want to hide specific user from the store list loop you have to filter out them from the loop itself. You can take a look at this discussion – https://wordpress.org/support/topic/exclude-admin-from-store-list/

    You will find two different solutions to tackle this matter.

    Thank you 🙂

    Thread Starter Fabricio10

    (@fabriciobarros10)

    @rur165
    Cool, I saw this code <?php
    foreach ( $sellers[‘users’] as $seller ) if ($seller->ID !== 1) I’m going to test it.

    where do i put it? in dokan-lite / templates / store-lists-loop.php?

    I need to hide several IDs. How do I do? separated by comma? 2.5.5?

    • This reply was modified 3 years, 1 month ago by Fabricio10.

    Hello @fabriciobarros10 ,

    Yes, the code should go in the dokan-lite/templates/store-lists-loop.php file. This is a template file so you can override it via child theme.

    You can use an array to check from the list of IDs.

    $sellers_to_hide = array(1, 2, 3, 4);
    
    foreach ( $sellers['users'] as $seller ) if (!in_array($seller->ID, $sellers_to_hide))

    Learn more about the in_array in PHP here – https://www.php.net/manual/en/function.in-array.php

    Thank you 🙂

    Thread Starter Fabricio10

    (@fabriciobarros10)

    <?php
                  <em><strong>  foreach ( $sellers['users'] as $seller ) if ($seller->ID !== 1459) if ($seller->ID !== 1456) if ($seller->ID !== 1455) {</strong></em>
                        $vendor            = dokan()->vendor->get( $seller->ID );
                        $store_banner_id   = $vendor->get_avatar_id();
                        $store_name        = $vendor->get_shop_name();
                        $store_url         = $vendor->get_shop_url();
                        $store_rating      = $vendor->get_rating();
                        $is_store_featured = $vendor->is_featured();
                        $store_phone       = $vendor->get_phone();
                        $store_info        = dokan_get_store_info( $seller->ID );
                        $store_address     = dokan_get_seller_short_address( $seller->ID );
                        $store_banner_url  = $store_banner_id ? wp_get_attachment_image_src( $store_banner_id, $image_size ) : DOKAN_PLUGIN_ASSEST . '/images/default-store-banner.png';
                        ?>

    I tried several ways but I only managed to change this second line. Did it work for me, is there an error?

    here seems to be working correctly

    Hello @fabriciobarros10 ,

    The structure of the code does not seem to be right.

    You need to use && instead of if in your method –
    $sellers['users'] as $seller ) && ($seller->ID !== 1459) && ($seller->ID !== 1456) && ($seller->ID !== 1455)

    However, when you are writing it for multiple vendors, using the array method as I explained above will be the best way to follow. If you are not comfortable making these changes in code, please take help from a professional expert in this field.

    Thank you 🙂

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Hide store’ is closed to new replies.