Multi Vendor Marketplace Plugin | WCFM Marketplace › Forums › WC Bookings › How to make HAS RESOURCE & HAS PERSON pre-checked when creating booking product?
Tagged: pre-checked
- This topic has 6 replies, 2 voices, and was last updated 5 years, 5 months ago by WCFM Forum.
- AuthorPosts
- October 25, 2018 at 6:39 am #34914Lwifunyo MangulaParticipant
hi,
im asking how to make HAS RESOURCE and HAS PERSONS pre-checked by default when a vendor creating booking product? - October 25, 2018 at 6:40 am #34915Lwifunyo MangulaParticipant
the tick to be checked by default when publishing new product
- October 25, 2018 at 7:34 am #34919WCFM ForumKeymaster
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
- October 25, 2018 at 7:53 am #34924Lwifunyo MangulaParticipant
thanks. it worked as i requested.
- October 25, 2018 at 9:27 am #34932WCFM ForumKeymaster
Fantastic … you are welcome 🙂
- October 25, 2018 at 9:54 am #34935Lwifunyo MangulaParticipant
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 visiblei 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 ); - October 25, 2018 at 9:56 am #34936WCFM ForumKeymaster
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
- AuthorPosts
- The topic ‘How to make HAS RESOURCE & HAS PERSON pre-checked when creating booking product?’ is closed to new replies.