|
@@ 820-825 (lines=6) @@
|
| 817 |
|
if ( 'variable' === ( WC_Stripe_Helper::is_wc_lt( '3.0' ) ? $product->product_type : $product->get_type() ) && isset( $_POST['attributes'] ) ) { |
| 818 |
|
$attributes = array_map( 'wc_clean', $_POST['attributes'] ); |
| 819 |
|
|
| 820 |
|
if ( WC_Stripe_Helper::is_wc_lt( '3.0' ) ) { |
| 821 |
|
$variation_id = $product->get_matching_variation( $attributes ); |
| 822 |
|
} else { |
| 823 |
|
$data_store = WC_Data_Store::load( 'product' ); |
| 824 |
|
$variation_id = $data_store->find_matching_product_variation( $product, $attributes ); |
| 825 |
|
} |
| 826 |
|
|
| 827 |
|
if ( ! empty( $variation_id ) ) { |
| 828 |
|
$product = wc_get_product( $variation_id ); |
|
@@ 923-928 (lines=6) @@
|
| 920 |
|
if ( ( 'variable' === $product_type || 'variable-subscription' === $product_type ) && isset( $_POST['attributes'] ) ) { |
| 921 |
|
$attributes = array_map( 'wc_clean', $_POST['attributes'] ); |
| 922 |
|
|
| 923 |
|
if ( WC_Stripe_Helper::is_wc_lt( '3.0' ) ) { |
| 924 |
|
$variation_id = $product->get_matching_variation( $attributes ); |
| 925 |
|
} else { |
| 926 |
|
$data_store = WC_Data_Store::load( 'product' ); |
| 927 |
|
$variation_id = $data_store->find_matching_product_variation( $product, $attributes ); |
| 928 |
|
} |
| 929 |
|
|
| 930 |
|
WC()->cart->add_to_cart( $product->get_id(), $qty, $variation_id, $attributes ); |
| 931 |
|
} |