| @@ -67,10 +67,17 @@ | ||
| 67 | 67 | $order_items = $order->get_items(); |
| 68 | 68 | foreach ( $order_items as $order_item ) { |
| 69 | 69 | $product = Subscription::get_subs_product( $order_item['product_id'] ); |
| 70 | 70 | |
| 71 | - if ( $product->is_type( 'simple' ) && ! subscrpt_pro_activated() ) { | |
| 72 | - if ( $product->is_enabled() ) { | |
| 71 | + // Plan items are created by Frontend\PlanCheckout on `subscrpt_product_checkout` | |
| 72 | + // below (resolution order: tied plan first, else classic meta). Skipping | |
| 73 | + // them here keeps the classic path from creating a second subscription. | |
| 74 | + if ( $product->is_type( 'simple' ) && ! subscrpt_pro_activated() && ! $order_item->get_meta( '_subscrpt_plan_id' ) ) { | |
| 75 | + // A plan product bought as One-Time carries no plan id — it is not a | |
| 76 | + // subscription, so never record one for it. | |
| 77 | + $is_one_time = function_exists( 'subscrpt_product_has_plan' ) && subscrpt_product_has_plan( $product->get_id() ); | |
| 78 | + | |
| 79 | + if ( $product->is_enabled() && ! $is_one_time ) { | |
| 73 | 80 | $is_renew = isset( $order_item['renew_subscrpt'] ); |
| 74 | 81 | |
| 75 | 82 | $timing_option = $product->get_timing_option(); |
| 76 | 83 | $trial = $product->get_trial(); |