CSV Import Custom Fields Addon with own fields
-
Hi,
for our online shop we added some custom fields to the products which look like this:
// Display Fields add_action( 'woocommerce_product_options_general_product_data', 'woo_add_custom_general_fields' ); function woo_add_custom_general_fields() { global $woocommerce, $post; echo '<div class="options_group">'; // create custom fields // field dat woocommerce_wp_text_input( array( 'id' => '_dat', 'label' => __( 'DAT FIELD', 'woocommerce' ), 'placeholder' => 'DD.MM.YYYY', 'desc_tip' => 'true', 'description' => __( 'description of dat.', 'woocommerce' ) ) ); // field fz woocommerce_wp_text_input( array( 'id' => '_fz', 'label' => __( 'FZ FIELD', 'woocommerce' ), 'placeholder' => '', 'desc_tip' => 'true', 'description' => __( 'description of fz.', 'woocommerce' ) ) ); // field kz woocommerce_wp_text_input( array( 'id' => '_kz', 'label' => __( 'KZ FIELD', 'woocommerce' ), 'placeholder' => '', 'desc_tip' => 'true', 'description' => __( 'description of kz.', 'woocommerce' ) ) ); echo '</div>'; } // Save Fields add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' ); function woo_add_custom_general_fields_save( $post_id ){ // field dat $woocommerce_dat = $_POST['_dat']; if( !empty( $woocommerce_dat ) ) update_post_meta( $post_id, '_dat', esc_attr( $woocommerce_dat ) ); // field fz $woocommerce_fz = $_POST['_fz']; if( !empty( $woocommerce_fz ) ) update_post_meta( $post_id, '_fz', esc_attr( $woocommerce_fz ) ); // field kz $woocommerce_kz = $_POST['_kz']; if( !empty( $woocommerce_kz ) ) update_post_meta( $post_id, '_kz', esc_attr( $woocommerce_kz ) ); }
Now we installed the CSV Importer plugin and noticed that we also need the “custom fields” addon. We added “
_dat, _fz, _kz
” to custom fields in the settings tab and successfully see these fields in the header list, but when importing valid CSV files (with both custom field data and default field data) it won’t fill the custom fields, only default fields.Can you help us with that? Did we include our custom fields in a wrong way or is the accessing part (“
_dat, _fz, _kz
“) wrong?Thanks for reading,
KCC24
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘CSV Import Custom Fields Addon with own fields’ is closed to new replies.