Fix variation name in WC Analytics Variations report (#49440)
* Show "Any [ATTRIBUTE_NAME]" for variation product if attribute is empty
Like that in the product variation edit page:
35a0ee2e8a/plugins/woocommerce/includes/admin/meta-boxes/views/html-variation-admin.php (L36)
* Add changelog
This commit is contained in:
parent
e1b314229c
commit
c269a86efc
|
@ -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;
|
||||
|
|
|
@ -0,0 +1,4 @@
|
|||
Significance: patch
|
||||
Type: fix
|
||||
|
||||
Fix variation name in analytics variations report
|
Loading…
Reference in New Issue