|
@@ 691-696 (lines=6) @@
|
| 688 |
|
if ( 'variable' === ( WC_Stripe_Helper::is_pre_30() ? $product->product_type : $product->get_type() ) && isset( $_POST['attributes'] ) ) { |
| 689 |
|
$attributes = array_map( 'wc_clean', $_POST['attributes'] ); |
| 690 |
|
|
| 691 |
|
if ( WC_Stripe_Helper::is_pre_30() ) { |
| 692 |
|
$variation_id = $product->get_matching_variation( $attributes ); |
| 693 |
|
} else { |
| 694 |
|
$data_store = WC_Data_Store::load( 'product' ); |
| 695 |
|
$variation_id = $data_store->find_matching_product_variation( $product, $attributes ); |
| 696 |
|
} |
| 697 |
|
|
| 698 |
|
if ( ! empty( $variation_id ) ) { |
| 699 |
|
$product = wc_get_product( $variation_id ); |
|
@@ 781-786 (lines=6) @@
|
| 778 |
|
if ( 'variable' === ( WC_Stripe_Helper::is_pre_30() ? $product->product_type : $product->get_type() ) && isset( $_POST['attributes'] ) ) { |
| 779 |
|
$attributes = array_map( 'wc_clean', $_POST['attributes'] ); |
| 780 |
|
|
| 781 |
|
if ( WC_Stripe_Helper::is_pre_30() ) { |
| 782 |
|
$variation_id = $product->get_matching_variation( $attributes ); |
| 783 |
|
} else { |
| 784 |
|
$data_store = WC_Data_Store::load( 'product' ); |
| 785 |
|
$variation_id = $data_store->find_matching_product_variation( $product, $attributes ); |
| 786 |
|
} |
| 787 |
|
|
| 788 |
|
WC()->cart->add_to_cart( $product->get_id(), $qty, $variation_id, $attributes ); |
| 789 |
|
} |