Displaying of Vacation Mode Message

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!

Viewing 2 reply threads
  • Author
    Posts
    • #132431
      Jasmin Kronewetter
      Participant

      Hi,

      I was testing the Vacation Mode for vendors and noticed that if they insert a message, it will look like the attached image on the shop page. (I copy/pasted the “I’m on vacation” multiple times to see what a longer message would look like)

      I’m wondering if this is a theme issue or meant to be that way. Also if there’s anything that’s recommended to do in order to change how the message is displayed? It makes the entire shop page look awkward if such long messages can be displayed there.

      For example, could we have the vacation message display in the product listing (rather than the shop page), and only have something like a badge on the shop page to show that this vendor is currently on vacation?

      Thank you!

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

      Hello,

      By default in Single Product page will display “Vendor vacation message”. Using this “woocommerce_single_product_summary” hook.

      You can hide full message from shop page, and add small text/any vacation badge in shop page(each product )
      Try this code in your 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('init',function(){
      	global $WCFM, $WCFMmp, $WCFMu;
      
      	remove_action('woocommerce_after_shop_loop_item', array( $WCFMu->wcfmu_vendor_vacation, 'wcfm_vacation_mode' ), 9 );
      	
      });
      add_action('woocommerce_after_shop_loop_item','add_msg_to_store_loop_vacation_mode',45);
      function add_msg_to_store_loop_vacation_mode(){
      	
      	global $WCFM,$product;
      	$is_marketplace = wcfm_is_marketplace();
      	$vacation_mode = '';
      	$vendor_has_vacation = $WCFM->wcfm_vendor_support->wcfm_vendor_has_capability( $vendor_id, 'vacation' ); 
      	if ( ( !function_exists( 'wcfm_is_store_page' ) || ( function_exists( 'wcfm_is_store_page' ) && !wcfm_is_store_page() ) ) && ( is_product() || is_shop() || is_product_category() ) ) {
      			global $product, $post; 
      			if ( is_object( $product ) ) { 
      				$vendor_id   		= wcfm_get_vendor_id_by_post( $product->get_id() ); 
      			} else if ( is_product() ) {
      				$vendor_id   		= wcfm_get_vendor_id_by_post( $post->ID );
      			}
      	
      		if( $vendor_has_vacation ) {
      			if( $is_marketplace == 'wcfmmarketplace' ) {
      				$vendor_data = get_user_meta( $vendor_id, 'wcfmmp_profile_settings', true );
      				$vacation_mode = isset( $vendor_data['wcfm_vacation_mode'] ) ? $vendor_data['wcfm_vacation_mode'] : 'no';
      			
      			} else {
      				$vacation_mode 		= ( get_user_meta( $vendor_id, 'wcfm_vacation_mode', true ) ) ? get_user_meta( $vendor_id, 'wcfm_vacation_mode', true ) : 'no';
      			}
      		}
      		if ( $vacation_mode == 'yes' ) {
      			?>
      			<div class="wcfm_vacation_msg">On Vacation</div> 
      			<?php
      		}
      	}
      
      }

      Thanks.

    • #132934
      Jasmin Kronewetter
      Participant

      I’ll try that, thank you so much for the quick reply!

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