• Resolved jorenwouters

    (@jorenwouters)


    Hi,

    I want to export a custom field I made for WooCommerce Products, but it is not appearing in a feed in the list under “Value”.

    I made the field with the following code:

    add_action( 'woocommerce_product_options_inventory_product_data', 'woo_add_custom_inventory_fields' );
    
    function woo_add_custom_inventory_fields() {
    
      global $woocommerce, $post;
      
      echo '<div class="options_group">';
      
      woocommerce_wp_text_input( 
    	array( 
    		'id'          => '_ean_code', 
    		'label'       => __( 'EAN Code', 'woocommerce' ), 
    		'placeholder' => 'BRK7010BE',
    		'desc_tip'    => 'true',
    		'description' => __( 'Vul de EAN code voor dit product in. Vul "*" in als hij leeg moet zijn.', 'woocommerce' ) 
    		)
    	);
    	
      
      echo '</div>';
    	
    }
    
    add_action( 'woocommerce_process_product_meta', 'woo_add_custom_general_fields_save' );
    
    function woo_add_custom_general_fields_save( $post_id ){
    	// Text Field
    	$woocommerce_text_field = $_POST['_ean_code'];
    	if( !empty( $woocommerce_text_field ) )
    		update_post_meta( $post_id, '_ean_code', esc_attr( $woocommerce_text_field ) );
    		
    }
    

    Do you know how to fix this?

    Best Regards,

    Joren

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom fields not exporting’ is closed to new replies.