WC Lovers

WooCommerce Frontend Manager - Multivendor marketplace vendor dashboard

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!

Forum Replies Created

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • developer-9661
    Participant

    It works! Thanks!
    You are very helpful!

    developer-9661
    Participant

    Hi,

    I have the same issue with checkbox, I’ve added this code with plugin code-snippets:

    function add_allow_invoice( $settings_fields_general, $vendor_id ) {
    	if( isset( $settings_fields_general['store_name'] ) ) {
    		$allow_invoice = get_user_meta( $vendor_id, 'allow_invoice', true );
    		$settings_fields_general['allow_invoice'] = array(
    			'label' => __( 'Rechnung erlauben', 'ddwoo' ),
    			'type' => 'checkbox',
    			'priority' => 50,
    			'class' => 'wcfm-checkbox wcfm_ele',
    			'label_class' => 'wcfm_title wcfm_ele',
    			'value' => 'yes',
    			'dfvalue' => $allow_invoice
    		);
    	}
    	return $settings_fields_general;
    }
    add_filter('wcfm_marketplace_settings_fields_general', 'add_allow_invoice', 20, 2 );
    
    function save_custom_vendor_settings($vendor_id, $wcfm_settings_form) {
    	global $WCFM, $WCFMmp;
    	if( isset( $wcfm_settings_form['allow_invoice'] ) ) {
    		update_user_meta( $vendor_id, 'allow_invoice',  'yes' );
    	} else {
    		update_user_meta( $vendor_id, 'allow_invoice',  'no' );
    	}
    }
    add_action('wcfm_vendor_settings_update',  'save_custom_vendor_settings', 16, 2);

    But just like Jannis said, even if I unchecked the checkbox, the value of isset( $wcfm_settings_form[‘allow_invoice’] always return ‘yes’.
    And when I changed it to type = ‘text’, everything works fine. Please help.

Viewing 2 posts - 1 through 2 (of 2 total)