Order again with custom attributes.

Fixes #7601
This commit is contained in:
Mike Jolley 2015-03-09 15:50:13 +00:00
parent 079f978cb0
commit 4171a20e29
3 changed files with 6 additions and 4 deletions

View File

@ -505,7 +505,7 @@ class WC_Form_Handler {
foreach ( $item['item_meta'] as $meta_name => $meta_value ) {
if ( taxonomy_is_product_attribute( $meta_name ) ) {
$variations[ $meta_name ] = $meta_value[0];
} elseif ( meta_is_product_attribute( $meta_name, $meta_value, $product_id ) ) {
} elseif ( meta_is_product_attribute( $meta_name, $meta_value[0], $product_id ) ) {
$variations[ $meta_name ] = $meta_value[0];
}
}

View File

@ -308,13 +308,14 @@ if ( ! function_exists( 'meta_is_product_attribute' ) ) {
function meta_is_product_attribute( $name, $value, $product_id ) {
$product = wc_get_product( $product_id );
if ( $product->product_type != 'variation' ) {
if ( $product->product_type != 'variable' ) {
return false;
}
$attributes = $product->get_variation_attributes();
$variation_attributes = $product->get_variation_attributes();
$attributes = $product->get_attributes();
return ( in_array( $name, array_keys( $attributes ) ) && in_array( $value, $attributes[ $name ] ) );
return ( in_array( $name, array_keys( $attributes ) ) && in_array( $value, $variation_attributes[ $attributes[ $name ]['name'] ] ) );
}
}

View File

@ -143,6 +143,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Fix - Export report CSV.
* Fix - Settings API - allow multiselect fields to be emptied.
* Fix - Saving an order needs to save the discount amount ex. tax like the cart.
* Fix - Order again with custom attributes.
* Tweak - Show discounts inc. tax when showing order totals inc. tax.
* Tweak - Use 30 days instead of year for transients to avoid bugs in memcache plugins.
* Tweak - Add reports menu item if user can access reports but not the main WC section.