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:
commit
4131cf67bc
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue