__('Custom Product Options', 'my_text_domain'), 'target' => 'wcpa_product-meta-tab', 'priority' => 90 ); return $product_data_tabs; } public function woocommerce_process_product_meta_fields_save($post_id) { // This is the case to save custom field data of checkbox. You have to do it as per your custom fields $meta_field = array(); $form_order= array(); if (isset($_POST[WCPA_PRODUCT_META_FIELD])) { foreach ($_POST[WCPA_PRODUCT_META_FIELD] as $v) { $form_id = (int) sanitize_text_field($v); $meta_field[] = $form_id; if(isset($_POST['wcpa_product_meta_order']) && isset($_POST['wcpa_product_meta_order'][$form_id]) && $_POST['wcpa_product_meta_order'][$form_id]!==''){ // null and 0 need to be treated as different, if value is null, it will order based on the form default order $form_order[$form_id] = (int) sanitize_text_field($_POST['wcpa_product_meta_order'][$form_id]); } } } // asort($form_order); update_post_meta($post_id, WCPA_PRODUCT_META_KEY, $meta_field); update_post_meta($post_id, wcpa_product_meta_order, $form_order); if (isset($_POST['wcpa_exclude_global_forms'])) { update_post_meta($post_id, 'wcpa_exclude_global_forms', true); } else { update_post_meta($post_id, 'wcpa_exclude_global_forms', false); } if (!wcpa_get_option('wcpa_cf_bind_external',false) && isset($_POST['wcpa_product_cf']) && is_array($_POST['wcpa_product_cf'])) { $wcpa_product_cf = $_POST['wcpa_product_cf']; $custom_fields = wcpa_get_option('product_custom_fields'); $cf_prefix = wcpa_get_option('wcpa_cf_prefix','wcpa_pcf_'); foreach($custom_fields as $k=>$field){ if(isset($wcpa_product_cf[$k]) && !empty($wcpa_product_cf[$k])){ update_post_meta($post_id, $cf_prefix.$field['name'], $wcpa_product_cf[$k]); }else{ delete_post_meta($post_id, $cf_prefix.$field['name']); } } } } public function add_my_custom_product_data_fields() { $cf_prefix = wcpa_get_option('wcpa_cf_prefix','wcpa_pcf_'); global $post; $ml = new WCPA_Ml(); $meta_class = ''; if ($ml->is_active() && $ml->current_language()!==false && !$ml->is_default_lan() ) { $meta_class = 'wcpa_wpml_pro_meta'; } ?>