parent
f3762d9ed5
commit
be9b7bd4b5
|
@ -713,7 +713,13 @@ class WC_Form_Handler {
|
||||||
$missing_attributes = array();
|
$missing_attributes = array();
|
||||||
$variations = array();
|
$variations = array();
|
||||||
$attributes = $adding_to_cart->get_attributes();
|
$attributes = $adding_to_cart->get_attributes();
|
||||||
$variation = wc_get_product( $variation_id );
|
|
||||||
|
// If no variation ID is set, attempt to get a variation ID from posted attributes.
|
||||||
|
if ( empty( $variation_id ) ) {
|
||||||
|
$variation_id = $adding_to_cart->get_matching_variation( wp_unslash( $_POST ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
$variation = wc_get_product( $variation_id );
|
||||||
|
|
||||||
// Verify all attributes
|
// Verify all attributes
|
||||||
foreach ( $attributes as $attribute ) {
|
foreach ( $attributes as $attribute ) {
|
||||||
|
|
|
@ -560,7 +560,7 @@ class WC_Product_Variable extends WC_Product {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns an array of date for a variation. Used in the add to cart form.
|
* Returns an array of data for a variation. Used in the add to cart form.
|
||||||
* @since 2.4.0
|
* @since 2.4.0
|
||||||
* @param WC_Product $variation Variation product object or ID
|
* @param WC_Product $variation Variation product object or ID
|
||||||
* @return array
|
* @return array
|
||||||
|
|
Loading…
Reference in New Issue