diff --git a/plugins/woocommerce-admin/client/lib/async-requests/index.js b/plugins/woocommerce-admin/client/lib/async-requests/index.js index b2859557b5c..7e5e997e88d 100644 --- a/plugins/woocommerce-admin/client/lib/async-requests/index.js +++ b/plugins/woocommerce-admin/client/lib/async-requests/index.js @@ -1,6 +1,7 @@ /** * External dependencies */ +import { __, sprintf } from '@wordpress/i18n'; import { addQueryArgs } from '@wordpress/url'; import apiFetch from '@wordpress/api-fetch'; import { identity } from 'lodash'; @@ -106,7 +107,19 @@ export function getVariationName( { attributes, name } ) { } const attributeList = ( attributes || [] ) - .map( ( { option } ) => option ) + .map( ( { name: attributeName, option } ) => { + if ( ! option ) { + attributeName = + attributeName.charAt( 0 ).toUpperCase() + + attributeName.slice( 1 ); + option = sprintf( + // translators: %s: the attribute name. + __( 'Any %s', 'woocommerce' ), + attributeName + ); + } + return option; + } ) .join( ', ' ); return attributeList ? name + separator + attributeList : name; diff --git a/plugins/woocommerce/changelog/fix-33159-variation-name-in-analytics-variations-report b/plugins/woocommerce/changelog/fix-33159-variation-name-in-analytics-variations-report new file mode 100644 index 00000000000..15853722be6 --- /dev/null +++ b/plugins/woocommerce/changelog/fix-33159-variation-name-in-analytics-variations-report @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Fix variation name in analytics variations report