has person : Pre checked + hide it

WooCommerce Multivendor Marketplace – Home Forums WC Bookings has person : Pre checked + hide it

This topic contains 1 reply, has 2 voices, and was last updated by WCfM Forum WCfM Forum 2 weeks, 4 days ago.

  • Author
    Posts
  • #37774 Reply

    acaua ferreira

    How to pre check ‘has person’, and hide it ?

    I tried an old code found here on forum, but broked my site. What i did of wrong?

    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 );

  • #37803 Reply
    WCfM Forum
    WCfM Forum
    Keymaster

    Hi,

    Please use this code for the purpose –

    function wcfm_custom_2411_product_manage_fields_general( $general_fileds, $product_id, $product_type ) {
    	global $WCFM;
    	
    	if( isset( $general_fileds['_wc_booking_has_resources'] ) ) {
    		$general_fileds['_wc_booking_has_resources']['dfvalue'] = 'yes';
    	}
    	if( isset( $general_fileds['_wc_booking_has_persons'] ) ) {
    		$general_fileds['_wc_booking_has_persons']['dfvalue'] = 'yes';
    	}
    	return $general_fileds;
    }
    add_filter( 'wcfm_product_manage_fields_general', 'wcfm_custom_2411_product_manage_fields_general', 150, 3 );

    Thank You

Reply To: has person : Pre checked + hide it
Your information: