Forum Replies Created
Viewing 2 posts - 1 through 2 (of 2 total)
- AuthorPosts
- April 26, 2020 at 12:22 am in reply to: [Bug?] Custom field for vendor settings – uncheck a checkbox #123031developer-9661Participant
It works! Thanks!
You are very helpful!April 23, 2020 at 10:36 pm in reply to: [Bug?] Custom field for vendor settings – uncheck a checkbox #122276developer-9661ParticipantHi,
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. - AuthorPosts
Viewing 2 posts - 1 through 2 (of 2 total)