Show store hour in [wcfm_stores] it's possible?

We're shifting our Forum based support to a more dedicated support system!

We'll be closing our Forum support from 10th June, 2020 and move to Email Support assistance.

  • If you are a WCFM premium add-ons user, contact us- here
  • Want to know more before buying our add-ons? Send Pre sale queries- here
  • If you are a WCFM free user, please open a support ticket at WordPress.org
  • For WCFM App related queries, reach us- here
From now the forum will be read-only!

Multi Vendor Marketplace Plugin | WCFM Marketplace Forums WC Marketplace Show store hour in [wcfm_stores] it's possible?

Tagged: , , ,

Viewing 9 reply threads
  • Author
    Posts
    • #119573
      HERMES ALVES SOUZA
      Participant

      Hello,

      Is it possible to show the opening hours of the stores in the list? Using or shortcode I need to display whether the stores are currently open or closed.

      https://docs.wclovers.com/store-list/
      https://wclovers.com/knowledgebase/wcfm-marketplace-store-hours/

    • #119646

      Hello,

      To show store hours in the store list page,
      Add this code to your child theme’s functions.php
      In case you do not have child theme then add code using this plugin – https://wordpress.org/plugins/code-snippets/

      add_action('wcfmmp_store_list_after_store_info','fn_wcfmmp_store_list_after_store_info',11,2);
      function fn_wcfmmp_store_list_after_store_info($store_id, $store_info) {
      	global $WCFM, $WCFMmp, $wp, $WCFM_Query;
      	$store_user  = wcfmmp_get_store( $store_id );		
      	$wcfm_vendor_store_hours = get_user_meta( $store_id, 'wcfm_vendor_store_hours', true );
      	if( !$wcfm_vendor_store_hours ) {
      		return;
      	}	
      	$wcfm_store_hours_enable = isset( $wcfm_vendor_store_hours['enable'] ) ? 'yes' : 'no';
      	if( $wcfm_store_hours_enable != 'yes' ) return;	
      	$wcfm_store_hours_off_days  = isset( $wcfm_vendor_store_hours['off_days'] ) ? $wcfm_vendor_store_hours['off_days'] : array();
      	$wcfm_store_hours_day_times = isset( $wcfm_vendor_store_hours['day_times'] ) ? $wcfm_vendor_store_hours['day_times'] : array();
      	if( empty( $wcfm_store_hours_day_times ) ) return;	
      	$weekdays = array( 0 => __( 'Monday', 'wc-multivendor-marketplace' ), 1 => __( 'Tuesday', 'wc-multivendor-marketplace' ), 2 => __( 'Wednesday', 'wc-multivendor-marketplace' ), 3 => __( 'Thursday', 'wc-multivendor-marketplace' ), 4 => __( 'Friday', 'wc-multivendor-marketplace' ), 5 => __( 'Saturday', 'wc-multivendor-marketplace' ), 6 => __( 'Sunday', 'wc-multivendor-marketplace') );
      	?>
      	<div class="wcfmmp_store_hours">
      	<span class="wcfmmp-store-hours widget-title"><span class="wcfmfa fa-clock"></span>Store Hours</span><div class="wcfm_clearfix"></div>	
      	<?php
      	foreach( $wcfm_store_hours_day_times as $wcfm_store_hours_day => $wcfm_store_hours_day_time_slots ) {
      			if( in_array( $wcfm_store_hours_day, $wcfm_store_hours_off_days ) ) continue;
      			if( !isset( $wcfm_store_hours_day_time_slots[0] ) || !isset( $wcfm_store_hours_day_time_slots[0]['start'] ) ) return;
      			if( empty( $wcfm_store_hours_day_time_slots[0]['start'] ) || empty( $wcfm_store_hours_day_time_slots[0]['end'] ) ) continue;			
      			echo '<span class="wcfmmp-store-hours-day">' . $weekdays[$wcfm_store_hours_day] . ':</span>';			
      			foreach( $wcfm_store_hours_day_time_slots as $slot => $wcfm_store_hours_day_time_slot ) {
      				echo "<br />" . date_i18n( wc_time_format(), strtotime( $wcfm_store_hours_day_time_slot['start'] ) ) . " - " . date_i18n( wc_time_format(), strtotime( $wcfm_store_hours_day_time_slot['end'] ) );
      			}
      			echo '<br /><br />';
      		}
      	?>
      	</div>
      	<?php		
      }

      Thanks.

    • #119862
      HERMES ALVES SOUZA
      Participant

      Works fine! Thanks again.

      Deus abençoe vocês.

    • #121055

      You are always welcome 🙂

      Let me know if there’s anything else we can help you with.
      Can we ask for a favor? Would you mind taking a few minutes to review our plugin at https://wordpress.org/support/plugin/wc-multivendor-marketplace/reviews/ and let others know about your 5 Star experience with WCFM Marketplace. Also, follow us on Twitter https://twitter.com/wcfmmp for more exciting news, important updates, and irresistible offers.

    • #141502
      zsoldosbotondangol
      Participant

      Hi

      I would be grateful for some help with this one as well
      So my problem is that this code displays opening hours for every day and it looks like this for me
      Could you please help me with displaying just today’s opening hours without this bugging? For instance, if it’s Friday I only want to see Friday opening hours
      Many thanks in advance

      Attachments:
      You must be logged in to view attached files.
      • #142039

        Hello,

        For this, you need to override wcfmmp-view-store-hours.php in your theme folder yourtheme/wcfm/store/widgets from \wp-content\plugins\wc-multivendor-marketplace\views\store\widgets and modify the code –

        global $WCFM, $WCFMmp;
        $day_number = date('w', time());
        if($day_number == 0) {
        	$day = 6;
        } else {
        	$day = $day_number-1;
        }
        foreach( $wcfm_store_hours_day_times[$day] as $wcfm_store_hours_day => $wcfm_store_hours_day_time_slots ) {
        	
        	if( in_array( $wcfm_store_hours_day, $wcfm_store_hours_day_times[$day] ) ) continue;
        	
        	if( !isset( $wcfm_store_hours_day_time_slots['start'] ) ) return;
        	if( empty( $wcfm_store_hours_day_time_slots['start'] ) || empty( $wcfm_store_hours_day_time_slots['end'] ) ) continue;
        	echo '<span class="wcfmmp-store-hours-day">' . $weekdays[$day] . ':</span>';
        	
        		echo "<br />" . date_i18n( wc_time_format(), strtotime( $wcfm_store_hours_day_time_slots['start'] ) ) . " - " . date_i18n( wc_time_format(), strtotime( $wcfm_store_hours_day_time_slots['end'] ) );
        	
        	echo '<br /><br />';
        }

        Thanks.

    • #142791
      zsoldosbotondangol
      Participant

      Hi,

      thank you for the quick reply – this code, however, doesn’t do anything. I’m using OceanWP – I didn’t have a yourtheme/wcfm/store/widget folder, but I created it – copied the file there and pasted the code you wrote here. Can you please tell me in a bit more detail what should I do here? Because I’m sure I did it in the wrong way 😀

    • #142792
      zsoldosbotondangol
      Participant

      Hi,

      Sorry I might’ve wrote it wrong – so it does work on the simple product page/store page, but it doesn’t work for the cards (the store_list)

    • #142793
      zsoldosbotondangol
      Participant

      Also the bug is still there, please check the picture below

      Attachments:
      You must be logged in to view attached files.
    • #145100
      zsoldosbotondangol
      Participant

      Hello,

      I know you must be very busy these days but I opened some threads regarding this topic on other support sites, could you please answer my questions? I would be really grateful for your help & if we need to pay for this please notify us about the price

      Thank You

      https://wordpress.org/support/topic/vendor-price-range/
      https://wordpress.org/support/topic/store-hours-only-today/

    • #156790
      gilcrodua
      Participant

      Hi, also want to inquire about the same. is it possible for the store banner to show if the store is closed instead of accessing the store directly (same message that is showing in the store page when the store is closed?) (it will be nice if on the vendor list it shows the store status via the store banner- whether it’s open or closed)

Viewing 9 reply threads
  • You must be logged in to reply to this topic.