After the new 3.1.0 update, my custom variation stopped working due to a code update that checks my custom value against the pre-defined attribute values. With a little searching through the code using the error message it produced, i found that they have added the checking in "class-wc-form-handler.php" at around line 828.
// Allow if valid or show error.
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;
} else {
throw new Exception( sprintf( __( 'Invalid value posted for %s', 'woocommerce' ), wc_attribute_label( $attribute['name'] ) ) );
}
I commented that section and added "$variations[ $taxonomy ] = $value;" before that code block and my site is back to normal.
Walang komento:
Mag-post ng isang Komento