parent
4138b2b982
commit
bea7492e23
|
@ -826,7 +826,10 @@ class WC_Form_Handler {
|
||||||
$valid_value = isset( $variation_data[ $taxonomy ] ) ? $variation_data[ $taxonomy ] : '';
|
$valid_value = isset( $variation_data[ $taxonomy ] ) ? $variation_data[ $taxonomy ] : '';
|
||||||
|
|
||||||
// Allow if valid or show error.
|
// Allow if valid or show error.
|
||||||
if ( '' === $valid_value || $valid_value === $value ) {
|
if ( $valid_value === $value ) {
|
||||||
|
$variations[ $taxonomy ] = $value;
|
||||||
|
// If valid values are empty, this is an 'any' variation so get all possible values.
|
||||||
|
} elseif ( '' === $valid_value && in_array( $value, $attribute->get_slugs() ) ) {
|
||||||
$variations[ $taxonomy ] = $value;
|
$variations[ $taxonomy ] = $value;
|
||||||
} else {
|
} else {
|
||||||
throw new Exception( sprintf( __( 'Invalid value posted for %s', 'woocommerce' ), wc_attribute_label( $attribute['name'] ) ) );
|
throw new Exception( sprintf( __( 'Invalid value posted for %s', 'woocommerce' ), wc_attribute_label( $attribute['name'] ) ) );
|
||||||
|
|
Loading…
Reference in New Issue