• Resolved pablotomi95

    (@pablotomi95)


    Hello

    Dokan has a function that displays whether a vendor is open or closed based on the opening and closing hours set by the vendor BUT this is displayed only on the vendor store page.
    However, a customer can still purchase a product without knowing if the vendor is open or closed.
    I would be nice to display a notice on the single product page just below the product image, stating that the vendor is closed.
    something like “This Vendor is: Closed”

    i also used this code and read this topic alsoon functions.php on martfury child theme but I have an issue that just appears closed all the time even store is open.any solution for that ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello @pablotomi95 ,

    Thanks for pointing this out.

    I have updated the code in my Gist and now it should work properly. Here is the updated code –

    //Add store open-show information before single product add-to-cart button
    add_action('woocommerce_before_add_to_cart_form', 'dokan_open_close', 1000);
    
    function dokan_open_close() {
        global $product;
        $seller_id = get_post_field( 'post_author', $product->get_id());
        $store_info = dokan_get_store_info( $seller_id );
        
        $dokan_store_time_enabled = isset( $store_info['dokan_store_time_enabled'] ) ? $store_info['dokan_store_time_enabled'] : '';
        $dokan_store_time_enabled = isset( $store_info['dokan_store_time_enabled'] ) ? $store_info['dokan_store_time_enabled'] : '';
        $store_open_notice        = isset( $store_info['dokan_store_open_notice'] ) && ! empty( $store_info['dokan_store_open_notice'] ) ? $store_info['dokan_store_open_notice'] : __( 'Store Open', 'dokan-lite' );
        $store_closed_notice      = isset( $store_info['dokan_store_close_notice'] ) && ! empty( $store_info['dokan_store_close_notice'] ) ? $store_info['dokan_store_close_notice'] : __( 'Store Closed', 'dokan-lite' );
        $show_store_open_close    = dokan_get_option( 'store_open_close', 'dokan_appearance', 'on' );
    
        if ( $show_store_open_close == 'on' && $dokan_store_time_enabled == 'yes') { ?>
            <div class="dokan-store-open-close">
                <i class="fa fa-shopping-cart"></i>
                <?php if ( dokan_is_store_open( $seller_id ) ) {
                    echo esc_attr( $store_open_notice );
                } else {
                    echo esc_attr( $store_closed_notice );
                } ?>
            </div>
    
            <?php 
        }
    }

    I hope this helps.

    Thank you ??

    Thread Starter pablotomi95

    (@pablotomi95)

    yes its works perfectly this will very very very usefull i will think about purshasing the pro version now thank you

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Display Store Closed Or Open On Product Page on martfury Theme’ is closed to new replies.