• Resolved hamster84

    (@hamster84)


    Your plugin has been working wonderfully, but recently my custom fields have not been properly exporting.

    The field name is exported in the CSV, but the value is empty. I added the custom fields to the dropdown using PHP, and it was working previously, but I no longer see them in the dropdown. However, they still appear in the checked list of fields to export.

    The custom fields I am trying to export are located within the user profile, and are labeled as TaxType and BrandingTheme.

    This is the code I used to create the fields in the dropdown:

    add_filter('woe_get_order_fields_user', 'add_user_fields');
    function add_user_fields($fields) {
    	$fields['brandingtheme'] = array('segment'=>'user','label'=>'BrandingTheme','colname'=>'BrandingTheme','value'=>'','checked'=>1);
    	$fields['taxtype'] = array('segment'=>'user','label'=>'TaxType','colname'=>'TaxType','value'=>'','checked'=>1);
    	return $fields;
    }
    
    add_filter('woe_get_order_csv_value_brandingtheme', 'get_user_custom_field', 10, 2 );
    function get_user_custom_field($value,$order) {
    	$user_id = $order->get_user_id();
    	return get_user_meta($user_id, 'brandingtheme', true);
    }
    
    add_filter('woe_get_order_csv_value_taxtype', 'get_user_custom_field2', 10, 2 );
    function get_user_custom_field2($value,$order) {
    	$user_id = $order->get_user_id();
    	return get_user_meta($user_id, 'taxtype', true);
    }

    Any ideas or insights as to why it no longer works would be greatly appreciated. Thank you!

    https://ww.wp.xz.cn/plugins/woo-order-export-lite/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author algol.plus

    (@algolplus)

    hello

    do you still use CSV format ?
    if you’ve switched to XLS

    you should use following code

    add_filter('woe_get_order_xls_value_brandingtheme', 'get_user_custom_field', 10, 2 );
    
    add_filter('woe_get_order_xls_value_taxtype', 'get_user_custom_field2', 10, 2 );

    Plugin Author algol.plus

    (@algolplus)

    Version 1.2.3 supports usermeta fields.

    Please, update the plugin and delete custom code from functions.php 🙂

    • This reply was modified 9 years, 7 months ago by algol.plus.
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Custom field values not exporting’ is closed to new replies.