Export: properly escape commas in attribute values

This commit is contained in:
Jonathan Sadowski 2020-06-09 16:01:32 -05:00
parent ed41b146d6
commit 5b232ff489
1 changed files with 2 additions and 2 deletions

View File

@ -656,10 +656,10 @@ class WC_Product_CSV_Exporter extends WC_CSV_Batch_Exporter {
if ( 0 === strpos( $attribute_name, 'pa_' ) ) {
$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;
} else {
$row[ 'attributes:value' . $i ] = $attribute;
$row[ 'attributes:value' . $i ] = str_replace( ',', '\\,', $attribute );
$row[ 'attributes:taxonomy' . $i ] = 0;
}