| @@ -1,14 +1,22 @@ | ||
| 1 | 1 | <?php |
| 2 | +/** | |
| 3 | + * Service container bootstrap. | |
| 4 | + * | |
| 5 | + * @package SpringDevs\Subscription | |
| 6 | + */ | |
| 2 | 7 | |
| 3 | 8 | namespace SpringDevs\Subscription; |
| 4 | 9 | |
| 5 | 10 | use SpringDevs\Subscription\Frontend\Checkout; |
| 11 | +use SpringDevs\Subscription\Frontend\PlanCheckout; | |
| 6 | 12 | use SpringDevs\Subscription\Illuminate\AutoRenewal; |
| 7 | 13 | use SpringDevs\Subscription\Illuminate\Block; |
| 8 | 14 | use SpringDevs\Subscription\Illuminate\Cancellation; |
| 9 | 15 | use SpringDevs\Subscription\Illuminate\Cron; |
| 16 | +use SpringDevs\Subscription\Illuminate\StockPause; | |
| 10 | 17 | use SpringDevs\Subscription\Illuminate\Email; |
| 18 | +use SpringDevs\Subscription\Illuminate\Multilingual; | |
| 11 | 19 | use SpringDevs\Subscription\Illuminate\Order; |
| 12 | 20 | use SpringDevs\Subscription\Illuminate\Post; |
| 13 | 21 | use SpringDevs\Subscription\Illuminate\Stats; |
| 14 | 22 | use SpringDevs\Subscription\Illuminate\Gateways\Stripe\Stripe; |
| @@ -31,16 +39,52 @@ | ||
| 31 | 39 | new Subscription(); |
| 32 | 40 | new RoleManagement(); |
| 33 | 41 | new Order(); |
| 34 | 42 | new Cron(); |
| 43 | + new StockPause(); | |
| 35 | 44 | new Cancellation(); |
| 36 | 45 | new Stats(); |
| 37 | 46 | new Post(); |
| 38 | 47 | new Block(); |
| 39 | 48 | new Checkout(); |
| 49 | + // Pro ships a superset plan checkout (Subscribe & Save, Installments, | |
| 50 | + // variable / per-variation) on the same hooks and priorities, so free's | |
| 51 | + // Recurring-simple checkout runs only when Pro is absent — otherwise the two | |
| 52 | + // would create the subscription twice. | |
| 53 | + if ( ! subscrpt_pro_activated() ) { | |
| 54 | + new PlanCheckout(); | |
| 55 | + } | |
| 40 | 56 | new GuestCheckout(); |
| 41 | 57 | new AutoRenewal(); |
| 42 | 58 | new Email(); |
| 59 | + new Multilingual(); | |
| 60 | + | |
| 61 | + // Hide the internal plan snapshot meta from the admin order-item screen. | |
| 62 | + // WooCommerce's admin item view lists every meta key not in this filter | |
| 63 | + // (it does not hide the leading-underscore prefix there). Registered here — | |
| 64 | + // always loaded, both plugins share these keys — so it covers free and pro. | |
| 65 | + add_filter( 'woocommerce_hidden_order_itemmeta', array( $this, 'hidden_plan_order_itemmeta' ) ); | |
| 66 | + } | |
| 67 | + | |
| 68 | + /** | |
| 69 | + * Hide the plan snapshot meta keys on the admin order-item screen. | |
| 70 | + * | |
| 71 | + * @param array $keys Hidden order-item meta keys. | |
| 72 | + * | |
| 73 | + * @return array | |
| 74 | + */ | |
| 75 | + public function hidden_plan_order_itemmeta( $keys ) { | |
| 76 | + return array_merge( | |
| 77 | + (array) $keys, | |
| 78 | + array( | |
| 79 | + '_subscrpt_plan_id', | |
| 80 | + '_subscrpt_plan_group_id', | |
| 81 | + '_subscrpt_plan_price', | |
| 82 | + '_subscrpt_plan_payment_type', | |
| 83 | + '_subscrpt_plan_max_no_payment', | |
| 84 | + '_subscrpt_plan_terms', | |
| 85 | + ) | |
| 86 | + ); | |
| 43 | 87 | } |
| 44 | 88 | |
| 45 | 89 | /** |
| 46 | 90 | * Stripe Initialization. |