How to customize the export value base on specific meta key?

To change or alter data value in the export file data for the Import/Export add on plugin is very simple just follow the instruction in this sample code and paste it to your theme functions.php file.

// In this example we will change the Shipper Phone value with a prefix
// Metakey = wpcargo_shipper_phone
function my_custom_export_data( $value, $shipment_id, $meta_key ){
	if(  $meta_key === 'wpcargo_shipper_phone' ){
		return 'Phone: '.$value;		
	}
	return $value;
}
// wpc_ie_meta_data if the filter hook to change/alter the data value
add_filter('wpc_ie_meta_data', 'my_custom_export_data', 10, 3);

If you added a fields with the user options you may use this sample code

// In this example we will change the Driver ID into Fullname
// Metakey = wpcargo_driver
function my_custom_export_driver_data( $value, $shipment_id, $meta_key ){
        global $wpcargo; // Add the global $wpcargo to use its methods
	if(  $meta_key === 'wpcargo_driver' ){
		$driver_id = get_post_meta( $shipment_id, 'wpcargo_driver', true );
                // Make sure that the "wpcargo_driver" has a value
	        if( $driver_id ){
                   return $wpcargo->user_fullname( $driver_id );
                }else{
                   return $value;
                }
	}
	return $value;
}
// wpc_ie_meta_data if the filter hook to change/alter the data value
add_filter('wpc_ie_meta_data', 'my_custom_export_driver_data', 10, 3);
0
    0
    Your Cart
    Your cart is emptyReturn to Shop