function woocommerce_wp_multi_checkbox( $field ) {
global $thepostid, $post;
// $field['value'] = array();
$thepostid = empty( $thepostid ) ? $post->ID : $thepostid;
$field['class'] = isset( $field['class'] ) ? $field['class'] : 'select short';
$field['style'] = isset( $field['style'] ) ? $field['style'] : '';
$field['wrapper_class'] = isset( $field['wrapper_class'] ) ? $field['wrapper_class'] : '';
$field['name'] = isset( $field['name'] ) ? $field['name'] : $field['id'];
$field['desc_tip'] = isset( $field['desc_tip'] ) ? $field['desc_tip'] : false;
echo '<fieldset class="form-field ' . esc_attr( $field['id'] ) . '_field ' . esc_attr( $field['wrapper_class'] ) . '">
<legend>' . wp_kses_post( $field['label'] ) . '</legend>';
$meta_data = maybe_unserialize( get_post_meta( $thepostid, $field['id'], true ) );
$meta_data = $meta_data ? $meta_data : array();
$field['value'] = isset( $field['value'] ) ? $field['value'] : $meta_data;
print_r($field['value']);
if ( ! empty( $field['description'] ) && false !== $field['desc_tip'] ) {
echo wc_help_tip( $field['description'] );
}
echo '<ul class="wc-radios">';
foreach ( $field['options'] as $key => $value ) {
echo '<li><label><input
name="' . esc_attr( $field['name'] ) . '"
value="' . esc_attr( $key ) . '"
type="checkbox"
class="' . esc_attr( $field['class'] ) . '"
style="' . esc_attr( $field['style'] ) . '"
' . ( in_array( $key, $field['value'] ) ? 'checked="checked"' : '' ) . '
/> ' . esc_html( $value ) . '</label>
</li>';
}
echo '</ul>';
if ( ! empty( $field['description'] ) && false === $field['desc_tip'] ) {
echo '<span class="description">' . wp_kses_post( $field['description'] ) . '</span>';
}
echo '</fieldset>';
}
add_action('wp_enqueue_scripts', 'my_function', 10);
function my_function() {
wp_enqueue_script('wc-add-to-cart', get_template_directory_uri() .'/woocommerce/assets/js/frontend/add-to-cart.js', WC_VERSION, true);
}
Хотя метаполе сохраняется: