• Resolved r1nk

    (@r1nk)


    Hello,

    I manually add a custom field inside my functions.php by using this code :-

    add_action( 'woocommerce_product_options_general_product_data', 'my_custom_year_field' );
    
    function my_custom_year_field() {
    
    woocommerce_wp_text_input( 
        array( 
            'id'          => '_year', 
            'label'       => __( 'Year', 'woocommerce' ), 
            'placeholder' => 'Product year',
            'description' => __( 'Enter the product year', 'woocommerce' ) 
        )
    );
    
    }
    
    add_action( 'woocommerce_process_product_meta', 'my_custom_year_field_save' );
    
    function my_custom_year_field_save( $post_id ){  
    
        $year = $_POST['_year'];
        if( !empty( $year ) )
            update_post_meta( $post_id, '_year', esc_attr( $year ) );
    
    }

    So, basically it add a new field called Year. May I know why this field is not included when exporting and is there any solution?

    • This topic was modified 6 years, 5 months ago by r1nk.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘Custom input field not include when exporting’ is closed to new replies.