|
@@ 787-792 (lines=6) @@
|
| 784 |
|
if ( 'variable' === ( WC_Stripe_Helper::is_pre_30() ? $product->product_type : $product->get_type() ) && isset( $_POST['attributes'] ) ) { |
| 785 |
|
$attributes = array_map( 'wc_clean', $_POST['attributes'] ); |
| 786 |
|
|
| 787 |
|
if ( WC_Stripe_Helper::is_pre_30() ) { |
| 788 |
|
$variation_id = $product->get_matching_variation( $attributes ); |
| 789 |
|
} else { |
| 790 |
|
$data_store = WC_Data_Store::load( 'product' ); |
| 791 |
|
$variation_id = $data_store->find_matching_product_variation( $product, $attributes ); |
| 792 |
|
} |
| 793 |
|
|
| 794 |
|
if ( ! empty( $variation_id ) ) { |
| 795 |
|
$product = wc_get_product( $variation_id ); |
|
@@ 877-882 (lines=6) @@
|
| 874 |
|
if ( 'variable' === ( WC_Stripe_Helper::is_pre_30() ? $product->product_type : $product->get_type() ) && isset( $_POST['attributes'] ) ) { |
| 875 |
|
$attributes = array_map( 'wc_clean', $_POST['attributes'] ); |
| 876 |
|
|
| 877 |
|
if ( WC_Stripe_Helper::is_pre_30() ) { |
| 878 |
|
$variation_id = $product->get_matching_variation( $attributes ); |
| 879 |
|
} else { |
| 880 |
|
$data_store = WC_Data_Store::load( 'product' ); |
| 881 |
|
$variation_id = $data_store->find_matching_product_variation( $product, $attributes ); |
| 882 |
|
} |
| 883 |
|
|
| 884 |
|
WC()->cart->add_to_cart( $product->get_id(), $qty, $variation_id, $attributes ); |
| 885 |
|
} |