I have added two extra meta fields in my inventory tab in woocommerce.
I would like when I export my products, to be able to select these two meta fields or to have them automatically added in my exported csv file.
Is this possible?
The following is the part of creating my meta field
// Display Fields using WooCommerce Action Hook
add_action( 'woocommerce_product_options_inventory_product_data',
'woocom_inventory_product_data_custom_field' );
// Hook to save the data value from the custom fields
add_action( 'woocommerce_process_product_meta',
'woocom_save_inventory_proddata_custom_field' );
/** Hook callback function to save custom fields information */
function woocom_save_inventory_proddata_custom_field( $post_id ) {
// Save Text Field
$text_field = $_POST['_text_field'];
if( ! empty( $text_field ) ) {
update_post_meta( $post_id, '_text_field', esc_attr( $text_field ) );
}
}
function woocom_inventory_product_data_custom_field() {
// Create a custom text field
// Text Field
woocommerce_wp_text_input(
array(
'id' => '_text_field',
'label' => __( 'My Info', 'woocommerce' ),
'placeholder' => 'My Info',
'desc_tip' => 'true',
'description' => __( 'Input value.', 'woocommerce' )
)
);
}