0

I have a checkbox created using ACF in my product admin page. I have successfully added these checkboxes to the frontend but they are not updating when the vendor saves the form.

Here is my custom checkbox information...

field meta name: _personal_options Array options: name: Name message: Message Field key: field_5b54938f699a9

Here is my code that I added to the frontend product edit page/form

<div class="dokan-form-group">                                     
<label>
<input name="fields[field_5b54938f699a9][]" type="checkbox" id="acf-field-_personal_options" class="<?php echo 'id_' . $store_id; ?>" value="name" <?php checked('name', get_user_meta($store_id, 'acf-field-_personal_options', true), $echo = true) ?>/><?php _e('Enable gift name option', 'dokan');?>
</label>
</div>

<div class="dokan-form-group">
<label>
<input name="fields[field_5b54938f699a9][]" type="checkbox" id="acf-field-_personal_options-message" class="<?php echo 'id_' . $store_id; ?>" value="message" <?php checked('message', get_user_meta($store_id, 'acf-field-_personal_options-message', true), $echo = true) ?>/><?php _e('Enable gift message option', 'dokan');?>                                      
</label>
</div>

I have managed to get normal text fields to work fine but struggling with checkboxes. Here is my working text fields:

<label for="_personal_name_field" class="form-label">Gift name</label>
<?php dokan_post_input_box( $post_id, '_personal_name_field', array( 'placeholder' => 'Enter name...' ) ); ?> 

<label for="_personal_message_field" class="form-label">Gift message</label>
<?php dokan_post_input_box( $post_id, '_personal_message_field', array( 'placeholder' => 'Enter message...' ), 'textarea' ); ?>

Really really need help with this.

Andy
  • 1
  • The text fields that work above still populate ACF fields. The dokan form uses checkboxes also to update other woocommerce settings such as downloadable products options. – Andy Aug 06 '18 at 13:22
  • – Andy Aug 06 '18 at 13:22
  • So surely I must be able to utilise one of these the same as I did the text fields. I have managed to add those fields values to the cart and checkout and email etc. Its just the saving of the custom checkbox. – Andy Aug 06 '18 at 13:24
  • Any thoughts or help? – Andy Aug 13 '18 at 19:42

0 Answers0