Hide resources and persons tabs

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 15 reply threads
  • Author
    Posts
    • #102344
      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
      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
      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
      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
      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
      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
      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
      paattal
      Participant
      This reply has been marked as private.
    • #104212
      paattal
      Participant
      This reply has been marked as private.
    • #104406
      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
      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
      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
      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
      paattal
      Participant

      Hello,

      Nice thank you 🙂

    • #105436
      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!

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