JSON encode non-scalar values for CSV.
This commit is contained in:
parent
f0a01b09c0
commit
c13d35c68a
|
@ -198,6 +198,10 @@ class WC_Admin_Report_CSV_Exporter extends WC_CSV_Batch_Exporter {
|
||||||
} elseif ( is_callable( array( $this, "get_column_value_{$column_name}" ) ) ) {
|
} elseif ( is_callable( array( $this, "get_column_value_{$column_name}" ) ) ) {
|
||||||
// Handle special columns which don't map 1:1 to item data.
|
// Handle special columns which don't map 1:1 to item data.
|
||||||
$value = $this->{"get_column_value_{$column_name}"}( $item, $this->export_type );
|
$value = $this->{"get_column_value_{$column_name}"}( $item, $this->export_type );
|
||||||
|
|
||||||
|
} elseif ( ! is_scalar( $value ) ) {
|
||||||
|
// Ensure that the value is somewhat readable in CSV.
|
||||||
|
$value = wp_json_encode( $value );
|
||||||
}
|
}
|
||||||
|
|
||||||
$row[ $column_id ] = $value;
|
$row[ $column_id ] = $value;
|
||||||
|
|
Loading…
Reference in New Issue