Export: properly escape commas in attribute values
This commit is contained in:
parent
ed41b146d6
commit
5b232ff489
|
@ -656,10 +656,10 @@ class WC_Product_CSV_Exporter extends WC_CSV_Batch_Exporter {
|
||||||
|
|
||||||
if ( 0 === strpos( $attribute_name, 'pa_' ) ) {
|
if ( 0 === strpos( $attribute_name, 'pa_' ) ) {
|
||||||
$option_term = get_term_by( 'slug', $attribute, $attribute_name ); // @codingStandardsIgnoreLine.
|
$option_term = get_term_by( 'slug', $attribute, $attribute_name ); // @codingStandardsIgnoreLine.
|
||||||
$row[ 'attributes:value' . $i ] = $option_term && ! is_wp_error( $option_term ) ? str_replace( ',', '\\,', $option_term->name ) : $attribute;
|
$row[ 'attributes:value' . $i ] = $option_term && ! is_wp_error( $option_term ) ? str_replace( ',', '\\,', $option_term->name ) : str_replace( ',', '\\,', $attribute );
|
||||||
$row[ 'attributes:taxonomy' . $i ] = 1;
|
$row[ 'attributes:taxonomy' . $i ] = 1;
|
||||||
} else {
|
} else {
|
||||||
$row[ 'attributes:value' . $i ] = $attribute;
|
$row[ 'attributes:value' . $i ] = str_replace( ',', '\\,', $attribute );
|
||||||
$row[ 'attributes:taxonomy' . $i ] = 0;
|
$row[ 'attributes:taxonomy' . $i ] = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue