Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WCFM – Feature Request › Displaying of Vacation Mode Message
- This topic has 2 replies, 2 voices, and was last updated 4 years, 6 months ago by Jasmin Kronewetter.
- AuthorPosts
- May 18, 2020 at 11:21 am #132431Jasmin KronewetterParticipant
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. - May 18, 2020 at 7:19 pm #132660Sarmistha ChakrabortyMember
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.
- May 19, 2020 at 11:43 am #132934Jasmin KronewetterParticipant
I’ll try that, thank you so much for the quick reply!
- AuthorPosts
- You must be logged in to reply to this topic.