How to make HAS RESOURCE & HAS PERSON pre-checked when creating booking product?

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 Bookings How to make HAS RESOURCE & HAS PERSON pre-checked when creating booking product?

Tagged: 

Viewing 6 reply threads
  • Author
    Posts
    • #34914
      Lwifunyo Mangula
      Participant

      hi,
      im asking how to make HAS RESOURCE and HAS PERSONS pre-checked by default when a vendor creating booking product?

    • #34915
      Lwifunyo Mangula
      Participant

      the tick to be checked by default when publishing new product

    • #34919
      WCFM Forum
      Keymaster

      Hi,

      Please add this code to your site for the purpose –

      function wcfm_2510_product_manage_fields_general( $general_fields, $product_id, $product_type ) {
      	global $WCFM;
      	
      	if( !$product_id ) {
      		if( isset( $general_fields['_wc_booking_has_resources'] ) ) {
      			$general_fields['_wc_booking_has_resources']['dfvalue'] = 'yes';
      		}
      		
      		if( isset( $general_fields['_wc_booking_has_persons'] ) ) {
      			$general_fields['_wc_booking_has_persons']['dfvalue'] = 'yes';
      		}
      	}
      	
      	return $general_fields;
      }
      add_filter( 'wcfm_product_manage_fields_general', 'wcfm_2510_product_manage_fields_general', 100, 3 );

      Thank You

    • #34924
      Lwifunyo Mangula
      Participant

      thanks. it worked as i requested.

    • #34932
      WCFM Forum
      Keymaster

      Fantastic … you are welcome 🙂

    • #34935
      Lwifunyo Mangula
      Participant

      and I want to add in my BOOKING OPTION in product publishing form
      – booking duration==>customer defined
      – time unity==>days
      – minimum duration==>1 day
      – maximum duration==>30 days
      – enable calendar range picker==>yes
      – Calendar display mode==>always visible

      i try to add something like this as your privious code, but unfortunately it doesnot work. Where im failing? how can i do it.

      function wcfm_2510_product_manage_fields_general( $general_fields, $product_id, $product_type ) {
      global $WCFM;

      if( !$product_id ) {
      if( isset( $general_fields[‘_wc_booking_duration_type’] ) ) {
      $general_fields[‘_wc_booking_duration_type’][‘dfvalue’] = ‘customer’;
      }

      if( isset( $general_fields[‘_wc_booking_duration’] ) ) {
      $general_fields[‘_wc_booking_has_persons’][‘dfvalue’] = ‘2’;
      }

      if( isset( $general_fields[‘_wc_booking_min_duration’] ) ) {
      $general_fields[‘_wc_booking_has_resources’][‘dfvalue’] = ‘1’;
      }

      if( isset( $general_fields[‘_wc_booking_max_duration’] ) ) {
      $general_fields[‘_wc_booking_has_persons’][‘dfvalue’] = ’30’;
      }

      if( isset( $general_fields[‘_wc_booking_enable_range_picker’] ) ) {
      $general_fields[‘_wc_booking_has_resources’][‘dfvalue’] = ‘yes’;
      }

      }

      return $general_fields;
      }
      add_filter( ‘wcfm_product_manage_fields_general’, ‘wcfm_2510_product_manage_fields_general’, 100, 3 );

    • #34936
      WCFM Forum
      Keymaster

      Hi,

      Please don’t add such code.

      Checkbox and text fields are work differently.

      You have send me request on another topic, let’s discuss this there.

      Thank You

Viewing 6 reply threads
  • The topic ‘How to make HAS RESOURCE & HAS PERSON pre-checked when creating booking product?’ is closed to new replies.