|
@@ 718-723 (lines=6) @@
|
| 715 |
|
if ( 'variable' === ( WC_Stripe_Helper::is_pre_30() ? $product->product_type : $product->get_type() ) && isset( $_POST['attributes'] ) ) { |
| 716 |
|
$attributes = array_map( 'wc_clean', $_POST['attributes'] ); |
| 717 |
|
|
| 718 |
|
if ( WC_Stripe_Helper::is_pre_30() ) { |
| 719 |
|
$variation_id = $product->get_matching_variation( $attributes ); |
| 720 |
|
} else { |
| 721 |
|
$data_store = WC_Data_Store::load( 'product' ); |
| 722 |
|
$variation_id = $data_store->find_matching_product_variation( $product, $attributes ); |
| 723 |
|
} |
| 724 |
|
|
| 725 |
|
if ( ! empty( $variation_id ) ) { |
| 726 |
|
$product = wc_get_product( $variation_id ); |
|
@@ 808-813 (lines=6) @@
|
| 805 |
|
if ( 'variable' === ( WC_Stripe_Helper::is_pre_30() ? $product->product_type : $product->get_type() ) && isset( $_POST['attributes'] ) ) { |
| 806 |
|
$attributes = array_map( 'wc_clean', $_POST['attributes'] ); |
| 807 |
|
|
| 808 |
|
if ( WC_Stripe_Helper::is_pre_30() ) { |
| 809 |
|
$variation_id = $product->get_matching_variation( $attributes ); |
| 810 |
|
} else { |
| 811 |
|
$data_store = WC_Data_Store::load( 'product' ); |
| 812 |
|
$variation_id = $data_store->find_matching_product_variation( $product, $attributes ); |
| 813 |
|
} |
| 814 |
|
|
| 815 |
|
WC()->cart->add_to_cart( $product->get_id(), $qty, $variation_id, $attributes ); |
| 816 |
|
} |