diff --git a/includes/abstracts/abstract-wc-product.php b/includes/abstracts/abstract-wc-product.php index ebb0a052f99..a6f2cd5bb16 100644 --- a/includes/abstracts/abstract-wc-product.php +++ b/includes/abstracts/abstract-wc-product.php @@ -1104,7 +1104,7 @@ class WC_Product extends WC_Abstract_Legacy_Product { $attributes = array_fill_keys( array_keys( $this->get_attributes( 'edit' ) ), null ); foreach ( $raw_attributes as $attribute ) { if ( is_a( $attribute, 'WC_Product_Attribute' ) ) { - $attributes[ sanitize_text_field( $attribute->get_name() ) ] = $attribute; + $attributes[ sanitize_title( $attribute->get_name() ) ] = $attribute; } } diff --git a/includes/class-wc-ajax.php b/includes/class-wc-ajax.php index bd6907d02c5..51500c6c916 100644 --- a/includes/class-wc-ajax.php +++ b/includes/class-wc-ajax.php @@ -631,7 +631,7 @@ class WC_AJAX { $i = -1; foreach ( $data['attribute_names'] as $attribute_name ) { - $attribute = isset( $attributes[ $attribute_name ] ) ? $attributes[ $attribute_name ] : false; + $attribute = isset( $attributes[ sanitize_title( $attribute_name ) ] ) ? $attributes[ sanitize_title( $attribute_name ) ] : false; if ( ! $attribute ) { continue; }