Hide resources and persons tabs

This topic contains 15 replies, has 3 voices, and was last updated by Avatar Sushobhan 2 weeks, 1 day ago.

  • Author
    Posts
  • #102344
    Avatar
    paattal
    Participant

    Hello,

    On edit product I force to ‘0’ and hide “Has resources” + “Has persons” checkboxes but before update product, resources and persons tabs are displayed.

    How hidden those 2 tabs on first update ?

    Thank you

  • #102480
    Avatar
    Sushobhan
    Keymaster

    Hello,
    First tell me, how you hide the checkboxes “Has resources” + “Has persons” for bookable product? I guess you want to permanently hide those two tabs for Bookable product.
    Let me know.

    Thanks

  • #102745
    Avatar
    paattal
    Participant

    Hello,

    Yes I want permanently hide those two tabs and I use this snippet :

    add_filter( 'wcfm_product_manage_fields_general', 'wcfmbi_product_manage_fields_general', 100, 3 );
    function wcfmbi_product_manage_fields_general( $general_fields, $product_id, $product_type ) {
    	global $WCFM, $WCFMpb;
    	
    	if( isset( $general_fields['_wc_booking_has_resources'] ) ) {
    		$general_fields['_wc_booking_has_resources']['class'] = 'wcfm_custom_hide';
    		$general_fields['_wc_booking_has_resources']['desc_class'] = 'wcfm_custom_hide';
    		$general_fields['_wc_booking_has_resources']['dfvalue'] = 'no';
    	}
    		
    	if( isset( $general_fields['_wc_booking_has_persons'] ) ) {
    		$general_fields['_wc_booking_has_persons']['class'] = 'wcfm_custom_hide';
    		$general_fields['_wc_booking_has_persons']['desc_class'] = 'wcfm_custom_hide';
    		$general_fields['_wc_booking_has_persons']['dfvalue'] = 'no';
    	}
    		
    	return $general_fields;
    }

    Thank you

  • #102860
    Avatar
    Sushobhan
    Keymaster

    Hello,
    Use the following code instead-

    add_filter( 'wcfm_product_manage_fields_general', 'wcfmbi_product_manage_fields_general', 100, 3 );
    function wcfmbi_product_manage_fields_general( $general_fields, $product_id, $product_type ) {
    	global $WCFM, $WCFMpb;
    	
    	if( isset( $general_fields['_wc_booking_has_resources'] ) ) {
    		unset($general_fields['_wc_booking_has_resources']);
    	}
    		
    	if( isset( $general_fields['_wc_booking_has_persons'] ) ) {
    		unset($general_fields['_wc_booking_has_persons']);
    	}
    		
    	return $general_fields;
    }

    Let me know how this goes.

  • #103623
    Avatar
    paattal
    Participant

    Hello,

    Your code hide well both check boxes abd resources tab but persons tab is still displayed (see attached screenshot).

    Is it possible to hide also Yoast tab, it will be perfect ?

    Thank you

    Attachments:
    You must be logged in to view attached files.
  • #103638
    Avatar
    paattal
    Participant

    Sorry I saved a translation for resources tabs, in fact the 2 tabs are still displayed …

    Attachments:
    You must be logged in to view attached files.
  • #104195
    Avatar
    Sushobhan
    Keymaster

    Can you please share a temporary access of your site so that we can debug this. Also, don’t forget to mark your reply as private.

  • #104211
    Avatar
    paattal
    Participant
    This reply has been marked as private.
  • #104212
    Avatar
    paattal
    Participant
    This reply has been marked as private.
  • #104406
    Avatar
    Sushobhan
    Keymaster

    Hi,
    The two tabs ‘Resources’ and ‘Persons’ are removed now. For this the following code snippet is also added –

    function remove_booking_tabs() {
       global $WCFMu;
       remove_action( 'end_wcfm_products_manage', array( $WCFMu->wcfmu_wcbooking, 'wcb_wcfmu_products_manage_form_load_views' ), 30 );
    }
    
    add_action( 'wcfm_init', 'remove_booking_tabs', 20 );

    Will update you on rest of the things.

  • #104409
    Avatar
    paattal
    Participant

    Nice, thank you very much !

    Is it possible to do the same thing and add lines to hide attached tabs : [Location] Geo My Wp, [Yoast SEO] and [Tabs Manager] Woocommerce

    -> [Location] is only for grouped products and [Yoast SEO] + [Tabs Manager] are accessible only for admin.

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

    Hello,

    [Location] is only for grouped products
    >> Override the template wcfm-view-geomywp-products-manage.php in your theme’s <your active theme>/wcfm/products-manager/wcfm-view-geomywp-products-manage.php.
    and remove the class name “variable external booking”. (PFA)

    [Yoast SEO] + [Tabs Manager] are accessible only for admin
    >>Modify the script,

    function remove_booking_tabs() {
       global $WCFMu, $WCFM;
       remove_action( 'end_wcfm_products_manage', array( $WCFMu->wcfmu_wcbooking, 'wcb_wcfmu_products_manage_form_load_views' ), 30 );
       if(!current_user_can('administrator')) {
          add_filter('wcfm_is_allow_seo','__return_false');
          add_filter('wcfm_is_allow_wc_tabs_manager','__return_false');      
       }   
    }
    add_action( 'wcfm_init', 'remove_booking_tabs', 20 );
    Attachments:
    You must be logged in to view attached files.
  • #104795
    Avatar
    paattal
    Participant

    Hello,

    Really perfect ! WC Lovers is obviously the best support team !

    I include somme features since my last post and I need now to hide also Catalog Tab because I actvate/deactivate and hide all fields.

    Sorry, this is my last request on this topic what is the syntax filter to add to this code ?

    Thank you

  • #105413
    Avatar
    Sushobhan
    Keymaster

    Hello,
    You can use the following snippet to achieve the same –

    function remove_product_tabs() {
        global $WCFMu;
        remove_action( 'end_wcfm_products_manage', array( $WCFMu->wcfmu_wcbooking, 'wcb_wcfmu_products_manage_form_load_views' ), 30 );
        if ( ! current_user_can( 'administrator' ) ) {
            add_filter( 'wcfm_is_allow_seo', '__return_false' );
            add_filter( 'wcfm_is_allow_wc_tabs_manager', '__return_false' );
        }
    }
    
    add_action( 'wcfm_init', 'remove_product_tabs', 20 );
    
    function remove_catalog_tab() {
        add_filter( 'wcfm_is_allow_catalog', '__return_false' );
    }
    
    add_action( 'init', 'remove_catalog_tab', 9 );

    Let me know how it goes.
    Thanks

  • #105419
    Avatar
    paattal
    Participant

    Hello,

    Nice thank you 🙂

  • #105436
    Avatar
    Sushobhan
    Keymaster

    Hello,
    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.

    Thanks!

You must be logged in to reply to this topic.