Fix attribute saving

This commit is contained in:
claudiulodro 2018-09-19 11:35:46 -07:00
parent 3d2b0ab72b
commit 178f98ff65
2 changed files with 2 additions and 2 deletions

View File

@ -1104,7 +1104,7 @@ class WC_Product extends WC_Abstract_Legacy_Product {
$attributes = array_fill_keys( array_keys( $this->get_attributes( 'edit' ) ), null ); $attributes = array_fill_keys( array_keys( $this->get_attributes( 'edit' ) ), null );
foreach ( $raw_attributes as $attribute ) { foreach ( $raw_attributes as $attribute ) {
if ( is_a( $attribute, 'WC_Product_Attribute' ) ) { if ( is_a( $attribute, 'WC_Product_Attribute' ) ) {
$attributes[ sanitize_text_field( $attribute->get_name() ) ] = $attribute; $attributes[ sanitize_title( $attribute->get_name() ) ] = $attribute;
} }
} }

View File

@ -631,7 +631,7 @@ class WC_AJAX {
$i = -1; $i = -1;
foreach ( $data['attribute_names'] as $attribute_name ) { 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 ) { if ( ! $attribute ) {
continue; continue;
} }