Merge pull request #16715 from jamesgol/add_to_cart_variation

Allow variable products to be added via simple HTTP Request
This commit is contained in:
Claudio Sanches 2017-09-06 14:35:24 -03:00 committed by GitHub
commit 4131cf67bc
1 changed files with 1 additions and 7 deletions

View File

@ -855,13 +855,7 @@ class WC_Form_Handler {
// If no variation ID is set, attempt to get a variation ID from posted attributes.
if ( empty( $variation_id ) ) {
$data_store = WC_Data_Store::load( 'product' );
$variation_id = $data_store->find_matching_product_variation( $adding_to_cart, wp_unslash( $_POST ) );
}
// If no variation ID is set, attempt to get a variation ID from posted attributes.
if ( empty( $variation_id ) ) {
$data_store = WC_Data_Store::load( 'product' );
$variation_id = $data_store->find_matching_product_variation( $adding_to_cart, wp_unslash( $_POST ) );
$variation_id = $data_store->find_matching_product_variation( $adding_to_cart, array_map( 'sanitize_title', wp_unslash( $_REQUEST ) ) );
}
// Validate the attributes.