Home Forums WoodMart support forum Open close Store

Open close Store

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #253774

    cromapc
    Participant

    Hello, I need to put a code to show when a store in the marketplace is closed on the product page.
    I already have the code that works in another theme but it can’t work in woodmart. Might you help me? When I place it, the business always appears closed even though it is open.

    This is the code that I insert in function.php

    add_action(‘woocommerce_before_add_to_cart_form’, ‘dokan_open_close’, 1000);

    function dokan_open_close() {
    $store_user = dokan()->vendor->get( get_query_var( ‘author’ ) );
    $store_info = $store_user->get_shop_info();
    $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( $store_user->get_id() ) ) {
    echo esc_attr( $store_open_notice );
    } else {
    echo esc_attr( $store_closed_notice );
    } ?>
    </div>

    <?php
    }
    }

    #253812

    Hello,

    Such customization is not covered by our support, please try to find the plugin. The code can be influenced by other plugins, check.

    Best Regards

Viewing 2 posts - 1 through 2 (of 2 total)