PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 2.0.0
Subscriptions for WooCommerce with Stripe Recurring Payments v2.0.0
2.0.0 1.11.2 1.11.1 1.11.0 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.6 1.9.5 trunk 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 All 61 releases
← All changes | includes/Admin/Subscriptions.php +120 -279 1.4.02.0.0 View file →
@@ -25,14 +25,9 @@
25 25 add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_scripts' ) );
26 26 add_filter( 'post_row_actions', array( $this, 'post_row_actions' ) );
27 27 add_filter( 'manage_subscrpt_order_posts_columns', array( $this, 'add_custom_columns' ) );
28 28 add_action( 'manage_subscrpt_order_posts_custom_column', array( $this, 'add_custom_columns_data' ), 10, 2 );
29 - add_action( 'add_meta_boxes', array( $this, 'create_meta_boxes' ) );
30 - add_action( 'admin_head-post.php', array( $this, 'some_styles' ) );
31 - add_action( 'admin_head-post-new.php', array( $this, 'some_styles' ) );
32 - add_action( 'admin_footer-post.php', array( $this, 'some_scripts' ) );
33 - add_action( 'admin_footer-post-new.php', array( $this, 'some_scripts' ) );
34 - add_action( 'save_post', array( $this, 'save_subscrpt_order' ) );
29 + add_action( 'load-post.php', array( $this, 'redirect_legacy_edit_screen' ) );
35 30 add_filter( 'woocommerce_order_item_get_formatted_meta_data', array( $this, 'remove_order_meta' ), 10, 1 );
36 31 add_filter( 'bulk_actions-edit-subscrpt_order', array( $this, 'remove_bulk_actions' ) );
37 32 add_action( 'restrict_manage_posts', array( $this, 'add_subscription_filter_select' ) );
38 33 add_action( 'admin_menu', array( $this, 'add_overview_submenu' ), 40 );
@@ -38,8 +33,25 @@
38 33 add_action( 'admin_menu', array( $this, 'add_overview_submenu' ), 40 );
39 34 }
40 35
41 36 /**
37 + * Redirect the legacy CPT edit screen to the standalone details page.
38 + *
39 + * The subscription details UI now lives at
40 + * admin.php?page=wp-subscription-details. Anyone landing on the old
41 + * post.php edit screen for a subscrpt_order is sent there.
42 + *
43 + * @return void
44 + */
45 + public function redirect_legacy_edit_screen() {
46 + $post_id = isset( $_GET['post'] ) ? absint( wp_unslash( $_GET['post'] ) ) : 0; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
47 + if ( $post_id && 'subscrpt_order' === get_post_type( $post_id ) ) {
48 + wp_safe_redirect( admin_url( 'admin.php?page=wp-subscription-details&id=' . $post_id ) );
49 + exit;
50 + }
51 + }
52 +
53 + /**
42 54 * Remove 'Edit` and 'Trash' from bulk actions.
43 55 *
44 56 * @param array $actions Action list.
45 57 *
@@ -107,12 +119,12 @@
107 119 *
108 120 * @return array
109 121 */
110 122 public function add_custom_columns( $columns ) {
111 - $columns['subscrpt_start_date'] = __( 'Start Date', 'sdevs_subscrpt' );
112 - $columns['subscrpt_customer'] = __( 'Customer', 'sdevs_subscrpt' );
113 - $columns['subscrpt_next_date'] = __( 'Next Date', 'sdevs_subscrpt' );
114 - $columns['subscrpt_status'] = __( 'Status', 'sdevs_subscrpt' );
123 + $columns['subscrpt_start_date'] = __( 'Start Date', 'subscription' );
124 + $columns['subscrpt_customer'] = __( 'Customer', 'subscription' );
125 + $columns['subscrpt_next_date'] = __( 'Next Date', 'subscription' );
126 + $columns['subscrpt_status'] = __( 'Status', 'subscription' );
115 127 unset( $columns['date'] );
116 128 unset( $columns['cb'] );
117 129
118 130 return $columns;
@@ -128,13 +140,13 @@
128 140 */
129 141 public function add_custom_columns_data( $column, $post_id ) {
130 142 // HPOS: Safe. Only retrieves WooCommerce order via CRUD, and subscription meta via post meta.
131 143 $order_id = get_post_meta( $post_id, '_subscrpt_order_id', true ); // HPOS: Only subscription meta, not order meta.
132 - $order = wc_get_order( $order_id ); // HPOS: Safe, uses WooCommerce CRUD.
144 + $order = wc_get_order( $order_id ); // HPOS: Safe, uses WooCommerce CRUD.
133 145 if ( $order ) {
134 146 if ( 'subscrpt_start_date' === $column ) {
135 147 $start_date = get_post_meta( $post_id, '_subscrpt_start_date', true );
136 - echo ! empty( $start_date ) ? esc_html( gmdate( 'F d, Y', $start_date ) ) : '-';
148 + echo ! empty( $start_date ) ? esc_html( wp_date( 'F d, Y', $start_date ) ) : '-';
137 149 } elseif ( 'subscrpt_customer' === $column ) {
138 150 ?>
139 151 <?php echo wp_kses_post( $order->get_formatted_billing_full_name() ); ?>
140 152 <br />
@@ -146,264 +158,126 @@
146 158 <?php endif; ?>
147 159 <?php
148 160 } elseif ( 'subscrpt_next_date' === $column ) {
149 161 $next_date = get_post_meta( $post_id, '_subscrpt_next_date', true );
150 - echo ! empty( $next_date ) ? esc_html( gmdate( 'F d, Y', $next_date ) ) : '-';
162 + echo ! empty( $next_date ) ? esc_html( wp_date( 'F d, Y', $next_date ) ) : '-';
151 163 } elseif ( 'subscrpt_status' === $column ) {
152 164 $status_obj = get_post_status_object( get_post_status( $post_id ) );
153 165 ?>
154 166 <span
155 - class="subscrpt-<?php echo esc_html( $status_obj->name ); ?>"><?php echo esc_html( $status_obj->label ); ?></span>
167 + class="subscrpt-legacy-status subscrpt-legacy-status--<?php echo esc_html( $status_obj->name ); ?>"><?php echo esc_html( $status_obj->label ); ?></span>
156 168 <?php
157 169 }
158 170 } else {
159 - esc_html_e( 'Order not found !!', 'sdevs_subscrpt' );
171 + esc_html_e( 'Order not found !!', 'subscription' );
160 172 }
161 173 }
162 174
163 175 /**
164 - * Create meta boxes for admin subscriptions.
165 - */
166 - public function create_meta_boxes() {
167 - remove_meta_box( 'submitdiv', 'subscrpt_order', 'side' );
168 - add_meta_box(
169 - 'subscrpt_order_save_post',
170 - __( 'Subscription Action', 'sdevs_subscrpt' ),
171 - array( $this, 'subscrpt_order_save_post' ),
172 - 'subscrpt_order',
173 - 'side',
174 - 'default'
175 - );
176 -
177 - add_meta_box(
178 - 'subscrpt_customer_info',
179 - __( 'Customer Info', 'sdevs_subscrpt' ),
180 - array( $this, 'customer_info' ),
181 - 'subscrpt_order',
182 - 'side',
183 - 'default'
184 - );
185 -
186 - add_meta_box(
187 - 'subscrpt_order_info',
188 - __( 'Subscription Info', 'sdevs_subscrpt' ),
189 - array( $this, 'subscrpt_order_info' ),
190 - 'subscrpt_order',
191 - 'normal',
192 - 'default'
193 - );
194 -
195 - add_meta_box(
196 - 'subscrpt_order_history',
197 - __( 'Subscription History', 'sdevs_subscrpt' ),
198 - array( $this, 'order_histories' ),
199 - 'subscrpt_order',
200 - 'normal',
201 - 'default'
202 - );
203 -
204 - add_meta_box(
205 - 'subscrpt_order_activities',
206 - __( 'Subscription Activities', 'sdevs_subscrpt' ),
207 - array( $this, 'order_activities' ),
208 - 'subscrpt_order',
209 - 'normal',
210 - 'default'
211 - );
212 - }
213 -
214 - /**
215 - * Display Order Histories.
176 + * Build the subscription info rows.
216 177 *
217 - * @param \WP_Post $post Post Object.
178 + * Assembles the label/value rows describing a subscription (product, cost,
179 + * dates, status, payment method, addresses, trial, etc.) and applies the
180 + * `subscrpt_admin_info_rows` filter so extensions (e.g. the Pro plugin) can
181 + * add or reorder rows. Returns null when the related order is missing.
218 182 *
219 - * @return void
220 - */
221 - public function order_histories( $post ) {
222 - $subscription_id = $post->ID;
223 - global $wpdb;
224 - $table_name = $wpdb->prefix . 'subscrpt_order_relation';
225 - // @phpcs:ignore
226 - $order_histories = $wpdb->get_results( $wpdb->prepare( 'SELECT * FROM %i WHERE subscription_id=%d', array(
227 - $table_name,
228 - $subscription_id,
229 - )
230 - )
231 - );
232 -
233 - include 'views/order-history.php';
234 - }
235 -
236 - /**
237 - * Display Order Activities
183 + * @param int $subscription_id Subscription (subscrpt_order) post ID.
238 184 *
239 - * @param \WP_Post $post Post Object.
240 - *
241 - * @return void
185 + * @return array<string,array{label:string,value:string}>|null
242 186 */
243 - public function order_activities( $post ) {
244 - if ( function_exists( 'subscrpt_pro_activated' ) ) :
245 - if ( subscrpt_pro_activated() ) :
246 - do_action( 'subscrpt_order_activities', $post->ID );
247 - else :
248 - ?>
249 - <div class="wp-subscription-admin-box wp-subscription-upgrade-pro-banner" style="margin-bottom:18px;display:flex;align-items:center;gap:18px;justify-content:space-between;background:linear-gradient(90deg,#38bdf8 0%,#6366f1 100%);border-radius:10px;padding:22px 28px;box-shadow:0 2px 12px rgba(56,189,248,0.08);color:#fff;">
250 - <div style="flex:1;">
251 - <div style="display:flex;align-items:center;gap:14px;">
252 - <span style="font-size:2.2em;line-height:1;">🚀</span>
253 - <span style="font-family:Georgia,serif;font-size:1.25em;font-weight:bold;">Upgrade to WP Subscription Pro</span>
254 - </div>
255 - <div style="margin-top:8px;font-size:1.08em;max-width:500px;opacity:0.95;">
256 - Unlock advanced features, automation, and priority support. Take your subscription business to the next level!
257 - </div>
258 - </div>
259 - <div style="flex-shrink:0;">
260 - <a href="https://wpsubscription.co/" target="_blank" class="button button-primary" style="background:#fff;color:#6366f1;font-weight:600;font-size:1.08em;padding:12px 28px;border:none;box-shadow:0 2px 8px rgba(99,102,241,0.10);border-radius:6px;">Upgrade to Pro</a>
261 - </div>
262 - </div>
263 - <?php
264 - endif;
265 - endif;
266 - }
267 -
268 - /**
269 - * Save subscription HTML.
270 - */
271 - public function subscrpt_order_save_post() {
272 - $actions_data = array(
273 - 'active' => array(
274 - 'label' => __( 'Activate Subscription', 'sdevs_subscrpt' ),
275 - 'value' => 'active',
276 - ),
277 - 'pending' => array(
278 - 'label' => __( 'Pending Subscription', 'sdevs_subscrpt' ),
279 - 'value' => 'pending',
280 - ),
281 - 'expire' => array(
282 - 'label' => __( 'Expire Subscription', 'sdevs_subscrpt' ),
283 - 'value' => 'expired',
284 - ),
285 - 'pe_cancelled' => array(
286 - 'label' => __( 'Pending Cancel Subscription', 'sdevs_subscrpt' ),
287 - 'value' => 'pe_cancelled',
288 - ),
289 - 'cancelled' => array(
290 - 'label' => __( 'Cancel Subscription', 'sdevs_subscrpt' ),
291 - 'value' => 'cancelled',
292 - ),
293 - );
294 -
295 - $map_actions = array(
296 - 'pending' => array( 'active', 'cancelled' ),
297 - 'active' => array( 'pe_cancelled', 'cancelled' ),
298 - 'pe_cancelled' => array( 'active', 'cancelled' ),
299 - 'cancelled' => array( 'active' ),
300 - 'expired' => array(),
301 - );
302 -
303 - $status = get_post_status( get_the_ID() );
304 - $actions = $map_actions[ $status ];
305 -
306 - include 'views/subscription-save-meta.php';
307 - }
308 -
309 - /**
310 - * Display Customer Info
311 - *
312 - * @param \WP_Post $post Post Object.
313 - *
314 - * @return void
315 - */
316 - public function customer_info( $post ) {
317 - $order_id = get_post_meta( $post->ID, '_subscrpt_order_id', true );
318 - $order = wc_get_order( $order_id );
319 - if ( ! $order ) {
320 - return;
321 - }
322 - include 'views/subscription-customer.php';
323 - }
324 -
325 - /**
326 - * Display subscription info.
327 - *
328 - * @return void
329 - */
330 - public function subscrpt_order_info() {
331 - $order_id = get_post_meta( get_the_ID(), '_subscrpt_order_id', true );
332 - $order_item_id = get_post_meta( get_the_ID(), '_subscrpt_order_item_id', true );
333 - $trial = get_post_meta( get_the_ID(), '_subscrpt_trial', true );
334 - $start_date = get_post_meta( get_the_ID(), '_subscrpt_start_date', true );
335 - $next_date = get_post_meta( get_the_ID(), '_subscrpt_next_date', true );
336 - $trial_start_date = get_post_meta( get_the_ID(), '_subscrpt_trial_started', true );
337 - $trial_end_date = get_post_meta( get_the_ID(), '_subscrpt_trial_ended', true );
338 - $trial_mode = get_post_meta( get_the_ID(), '_subscrpt_trial_mode', true );
187 + public static function get_info_rows( $subscription_id ) {
188 + $order_id = get_post_meta( $subscription_id, '_subscrpt_order_id', true );
189 + $order_item_id = get_post_meta( $subscription_id, '_subscrpt_order_item_id', true );
190 + $trial = get_post_meta( $subscription_id, '_subscrpt_trial', true );
191 + $start_date = get_post_meta( $subscription_id, '_subscrpt_start_date', true );
192 + $next_date = get_post_meta( $subscription_id, '_subscrpt_next_date', true );
193 + $trial_start_date = get_post_meta( $subscription_id, '_subscrpt_trial_started', true );
194 + $trial_end_date = get_post_meta( $subscription_id, '_subscrpt_trial_ended', true );
195 + $trial_mode = get_post_meta( $subscription_id, '_subscrpt_trial_mode', true );
339 196 $order = wc_get_order( $order_id );
340 197 if ( ! $order ) {
341 - return;
198 + return null;
342 199 }
343 200 $order_item = $order->get_item( $order_item_id );
344 201
345 202 $product_name = $order_item->get_name();
346 203 $product_link = get_the_permalink( $order_item->get_product_id() );
347 - $rows = array(
348 - 'product' => array(
349 - 'label' => __( 'Product', 'sdevs_subscrpt' ),
204 +
205 + // Get payment information
206 + $product_id = $order_item->get_product_id();
207 + $max_payments = subscrpt_get_max_payments( $subscription_id ) ? subscrpt_get_max_payments( $subscription_id ) : 0;
208 + $payments_made = subscrpt_count_payments_made( $subscription_id );
209 +
210 + $rows = array(
211 + 'product' => array(
212 + 'label' => __( 'Product', 'subscription' ),
350 213 'value' => '<a href="' . esc_html( $product_link ) . '" target="_blank">' . esc_html( $product_name ) . '</a>',
351 214 ),
352 - 'cost' => array(
353 - 'label' => __( 'Cost', 'sdevs_subscrpt' ),
354 - 'value' => Helper::format_price_with_order_item( get_post_meta( get_the_ID(), '_subscrpt_price', true ), $order_item->get_id() ),
215 + 'cost' => array(
216 + 'label' => __( 'Cost', 'subscription' ),
217 + 'value' => Helper::get_subscription_recurring_price_html( $subscription_id, $order_item ),
355 218 ),
356 - 'quantity' => array(
357 - 'label' => __( 'Qty', 'sdevs_subscrpt' ),
219 + 'quantity' => array(
220 + 'label' => __( 'Qty', 'subscription' ),
358 221 'value' => "x{$order_item->get_quantity()}",
359 222 ),
223 + );
224 +
225 + // Add payment information if max_payments is set and not unlimited
226 + if ( ! empty( $max_payments ) && $max_payments > 0 ) {
227 + $rows['total_payments'] = array(
228 + 'label' => __( 'Total Payments', 'subscription' ),
229 + 'value' => esc_html( $payments_made ) . ' / ' . esc_html( $max_payments ),
230 + );
231 + }
232 +
233 + $rows += array(
360 234 'start_date' => array(
361 - 'label' => __( 'Started date', 'sdevs_subscrpt' ),
362 - 'value' => ! empty( $start_date ) ? gmdate( 'F d, Y', $trial && $trial_start_date ? $trial_start_date : $start_date ) : '-',
235 + 'label' => __( 'Started date', 'subscription' ),
236 + 'value' => ! empty( $start_date ) ? wp_date( 'F d, Y', $trial && $trial_start_date ? $trial_start_date : $start_date ) : '-',
363 237 ),
364 238 'next_date' => array(
365 - 'label' => __( 'Payment due date', 'sdevs_subscrpt' ),
366 - 'value' => ! empty( $next_date ) ? gmdate( 'F d, Y', $trial && $trial_end_date && 'on' === $trial_mode ? $trial_end_date : ( $next_date ?? '-' ) ) : '-',
239 + 'label' => __( 'Payment due date', 'subscription' ),
240 + 'value' => ! empty( $next_date ) ? wp_date( 'F d, Y', $trial && $trial_end_date && 'on' === $trial_mode ? $trial_end_date : ( $next_date ?? '-' ) ) : '-',
367 241 ),
368 242 'status' => array(
369 - 'label' => __( 'Status', 'sdevs_subscrpt' ),
370 - 'value' => '<span class="subscrpt-' . get_post_status() . '">' . get_post_status_object( get_post_status() )->label . '</span>',
243 + 'label' => __( 'Status', 'subscription' ),
244 + 'value' => '<span class="subscrpt-legacy-status subscrpt-legacy-status--' . get_post_status( $subscription_id ) . '">' . get_post_status_object( get_post_status( $subscription_id ) )->label . '</span>',
371 245 ),
372 246 'payment_method' => array(
373 - 'label' => __( 'Payment Method', 'sdevs_subscrpt' ),
247 + 'label' => __( 'Payment Method', 'subscription' ),
374 248 'value' => empty( $order->get_payment_method_title() ) ? '-' : $order->get_payment_method_title(),
375 249 ),
376 250 'billing_address' => array(
377 - 'label' => __( 'Billing', 'sdevs_subscrpt' ),
378 - 'value' => $order->get_formatted_billing_address() ? $order->get_formatted_billing_address() : __( 'No billing address set.', 'sdevs_subscrpt' ),
251 + 'label' => __( 'Billing', 'subscription' ),
252 + 'value' => $order->get_formatted_billing_address() ? $order->get_formatted_billing_address() : __( 'No billing address set.', 'subscription' ),
379 253 ),
380 254 'shipping_address' => array(
381 - 'label' => __( 'Shipping', 'sdevs_subscrpt' ),
382 - 'value' => $order->get_formatted_shipping_address() ? $order->get_formatted_shipping_address() : __( 'No shipping address set.', 'sdevs_subscrpt' ),
255 + 'label' => __( 'Shipping', 'subscription' ),
256 + 'value' => $order->get_formatted_shipping_address() ? $order->get_formatted_shipping_address() : __( 'No shipping address set.', 'subscription' ),
383 257 ),
384 258 );
385 259 if ( $trial ) {
386 260 $rows = array_slice( $rows, 0, 3, true ) + array(
387 261 'trial' => array(
388 - 'label' => __( 'Trial', 'sdevs_subscrpt' ),
262 + 'label' => __( 'Trial', 'subscription' ),
389 263 'value' => $trial,
390 264 ),
391 265 'trial_period' => array(
392 - 'label' => __( 'Trial Period', 'sdevs_subscrpt' ),
393 - 'value' => ( $trial_start_date && $trial_end_date ? ' [ ' . gmdate( 'F d, Y', $trial_start_date ) . ' - ' . gmdate( 'F d, Y', $trial_end_date ) . ' ] ' : __( 'Trial isn\'t activated yet! ', 'sdevs_subscrpt' ) ),
266 + 'label' => __( 'Trial Period', 'subscription' ),
267 + 'value' => ( $trial_start_date && $trial_end_date ? ' [ ' . wp_date( 'F d, Y', $trial_start_date ) . ' - ' . wp_date( 'F d, Y', $trial_end_date ) . ' ] ' : __( 'Trial isn\'t activated yet! ', 'subscription' ) ),
394 268 ),
395 269 ) + array_slice( $rows, 3, count( $rows ) - 1, true );
396 270 }
397 271
398 272 if ( class_exists( 'WC_Stripe' ) && 'stripe' === $order->get_payment_method() ) {
399 - $is_auto_renew = get_post_meta( get_the_ID(), '_subscrpt_auto_renew', true );
273 + $is_auto_renew = get_post_meta( $subscription_id, '_subscrpt_auto_renew', true );
400 274 $new_rows = array();
401 275 foreach ( $rows as $key => $value ) {
402 276 $new_rows[ $key ] = $value;
403 277 if ( 'payment_method' === $key ) {
404 278 $new_rows['stripe_auto_renewal'] = array(
405 - 'label' => __( 'Stripe Auto Renewal', 'sdevs_subscrpt' ),
279 + 'label' => __( 'Stripe Auto Renewal', 'subscription' ),
406 280 'value' => '0' !== $is_auto_renew ? 'On' : 'Off',
407 281 );
408 282 }
409 283 }
@@ -410,62 +284,27 @@
410 284
411 285 $rows = $new_rows;
412 286 }
413 287
414 - $rows = apply_filters( 'subscrpt_admin_info_rows', $rows, get_the_ID(), $order );
288 + $rows = apply_filters( 'subscrpt_admin_info_rows', $rows, $subscription_id, $order );
415 289
416 - include 'views/subscription-info.php';
290 + return $rows;
417 291 }
418 292
419 293 /**
420 - * Include some styles.
294 + * Apply a status change to a subscription.
421 295 *
422 - * @return void
423 - */
424 - public function some_styles() {
425 - global $post;
426 - if ( 'subscrpt_order' === $post->post_type ) :
427 - ?>
428 - <style>
429 - .submitbox {
430 - display: flex;
431 - justify-content: space-around;
432 - }
433 -
434 - .subscrpt_sub_box {
435 - display: grid;
436 - line-height: 2;
437 - }
438 - </style>
439 - <?php
440 - endif;
441 - }
442 -
443 - /**
444 - * Disable changes popup.
296 + * Updates the subscription post status, fires the admin status-change email
297 + * notification, runs the subscription status action, and completes the
298 + * related order when the subscription becomes active. Called from the
299 + * standalone subscription details page.
445 300 *
301 + * @param int $post_id Subscription (subscrpt_order) post ID.
302 + * @param string $action Target status slug.
303 + *
446 304 * @return void
447 305 */
448 - public function some_scripts() {
449 - global $post;
450 - if ( 'subscrpt_order' === $post->post_type ) :
451 - ?>
452 - <script>
453 - jQuery(document).ready(function() {
454 - jQuery(window).off('beforeunload', null);
455 - });
456 - </script>
457 - <?php
458 - endif;
459 - }
460 -
461 - public function save_subscrpt_order( $post_id ) {
462 - if ( wp_is_post_revision( $post_id ) || ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) || ! isset( $_POST['subscrpt_order_action'] ) ) {
463 - return;
464 - }
465 - remove_all_actions( 'save_post' );
466 -
467 - $action = sanitize_text_field( wp_unslash( $_POST['subscrpt_order_action'] ) );
306 + public static function process_status_change( $post_id, $action ) {
468 307 $old_status = get_post_status( $post_id );
469 308
470 309 wp_update_post(
471 310 array(
@@ -483,9 +322,11 @@
483 322
484 323 $order_id = get_post_meta( $post_id, '_subscrpt_order_id', true );
485 324 if ( 'active' === $action ) {
486 325 $order = wc_get_order( $order_id );
487 - $order->update_status( 'completed' );
326 + if ( $order ) {
327 + $order->update_status( 'completed' );
328 + }
488 329 Action::status( $action, $post_id );
489 330 } else {
490 331 Action::status( $action, $post_id );
491 332 }
@@ -496,13 +337,13 @@
496 337 }
497 338
498 339 public function add_overview_submenu() {
499 340 // Remove and re-add submenu to ensure Overview is first
500 - remove_submenu_page('edit.php?post_type=subscrpt_order', 'edit.php?post_type=subscrpt_order');
341 + remove_submenu_page( 'edit.php?post_type=subscrpt_order', 'edit.php?post_type=subscrpt_order' );
501 342 add_submenu_page(
502 343 'edit.php?post_type=subscrpt_order',
503 - __( 'Overview', 'wp_subscription' ),
504 - __( 'Overview', 'wp_subscription' ),
344 + __( 'Overview', 'subscription' ),
345 + __( 'Overview', 'subscription' ),
505 346 'manage_options',
506 347 'subscription_overview',
507 348 array( $this, 'render_overview_page' ),
508 349 0
@@ -508,20 +349,20 @@
508 349 0
509 350 );
510 351 add_submenu_page(
511 352 'edit.php?post_type=subscrpt_order',
512 - __( 'All Subscriptions', 'wp_subscription' ),
513 - __( 'All Subscriptions', 'wp_subscription' ),
353 + __( 'All Subscriptions', 'subscription' ),
354 + __( 'All Subscriptions', 'subscription' ),
514 355 'manage_options',
515 356 'edit.php?post_type=subscrpt_order',
516 357 '',
517 358 1
518 359 );
519 - if ( ! class_exists('Sdevs_Wc_Subscription_Pro') ) {
360 + if ( ! class_exists( 'Sdevs_Wc_Subscription_Pro' ) ) {
520 361 add_submenu_page(
521 362 'edit.php?post_type=subscrpt_order',
522 - __( 'Go Pro', 'wp_subscription' ),
523 - __( 'Go Pro', 'wp_subscription' ),
363 + __( 'Go Pro', 'subscription' ),
364 + __( 'Go Pro', 'subscription' ),
524 365 'manage_options',
525 366 'wp_subscription_go_pro',
526 367 array( $this, 'render_go_pro_page' ),
527 368 99
@@ -534,30 +375,30 @@
534 375 <div class="wrap wpsubscription-overview" style="max-width:1100px;margin:40px auto 0 auto;">
535 376 <div class="wpsubscription-overview-card" style="background:#fff;border-radius:12px;box-shadow:0 2px 12px rgba(0,0,0,0.06);padding:40px 32px 32px 32px;">
536 377 <div class="wpsubscription-overview-top" style="display:grid;grid-template-columns:1fr 1fr;gap:40px;align-items:start;margin-bottom:40px;">
537 378 <div class="wpsubscription-overview-info" style="display:flex;flex-direction:column;gap:18px;">
538 - <h1 style="margin-bottom:0.2em;"><?php esc_html_e( 'WP Subscription Overview', 'wp_subscription' ); ?></h1>
379 + <h1 style="margin-bottom:0.2em;"><?php esc_html_e( 'WPSubscription Overview', 'subscription' ); ?></h1>
539 380 <p class="product-desc" style="font-size:1.15em;line-height:1.6;max-width:500px;">
540 - <?php esc_html_e( 'WP Subscription is the most seamless and reliable WooCommerce subscription solution for store owners looking to grow recurring revenue. Easily manage recurring payments, automate renewals, and delight your customers with flexible plans.', 'wp_subscription' ); ?>
381 + <?php esc_html_e( 'WPSubscription is the most seamless and reliable WooCommerce subscription solution for store owners looking to grow recurring revenue. Easily manage recurring payments, automate renewals, and delight your customers with flexible plans.', 'subscription' ); ?>
541 382 </p>
542 383 <div class="wpsubscription-links" style="display:flex;gap:12px;flex-wrap:wrap;">
543 - <a href="https://converslabs.thrivedeskdocs.com/en" target="_blank" class="button button-secondary"><?php esc_html_e( 'Documentation', 'wp_subscription' ); ?></a>
544 - <a href="https://wpsubscription.co/" target="_blank" class="button button-secondary"><?php esc_html_e( 'Website', 'wp_subscription' ); ?></a>
384 + <a href="https://docs.wpsubscription.co/en?utm_source=plugin&utm_medium=admin&utm_campaign=docs" target="_blank" class="button button-secondary"><?php esc_html_e( 'Documentation', 'subscription' ); ?></a>
385 + <a href="https://wpsubscription.co/?utm_source=plugin&utm_medium=admin&utm_campaign=upgrade_pro" target="_blank" class="button button-secondary"><?php esc_html_e( 'Website', 'subscription' ); ?></a>
545 386 </div>
546 387 </div>
547 388 <div class="promo-video" style="text-align:center;">
548 - <iframe width="420" height="236" src="https://www.youtube.com/embed/2e6o5p0M7L4" title="WP Subscription Promo" frameborder="0" allowfullscreen style="max-width:100%;border-radius:8px;"></iframe>
389 + <iframe width="420" height="236" src="https://www.youtube.com/embed/2e6o5p0M7L4" title="WPSubscription Promo" frameborder="0" allowfullscreen style="max-width:100%;border-radius:8px;"></iframe>
549 390 </div>
550 391 </div>
551 392
552 393 <div class="wpsubscription-what-section" style="margin-bottom:40px;">
553 - <h2><?php esc_html_e( 'What does Subscriptions for WooCommerce do?', 'wp_subscription' ); ?></h2>
394 + <h2><?php esc_html_e( 'What does Subscriptions for WooCommerce do?', 'subscription' ); ?></h2>
554 395 <p style="font-size:1.08em;max-width:900px;line-height:1.7;">
555 - <?php esc_html_e( 'Subscriptions for WooCommerce enables you to create and manage recurring payment products and services with ease. Automate renewals, offer flexible billing schedules, and provide your customers with a seamless subscription experience. Whether you sell digital content, physical goods, or memberships, WP Subscription gives you the tools to grow your recurring revenue.', 'wp_subscription' ); ?>
396 + <?php esc_html_e( 'Subscriptions for WooCommerce enables you to create and manage recurring payment products and services with ease. Automate renewals, offer flexible billing schedules, and provide your customers with a seamless subscription experience. Whether you sell digital content, physical goods, or memberships, WPSubscription gives you the tools to grow your recurring revenue.', 'subscription' ); ?>
556 397 </p>
557 398 </div>
558 399
559 - <h2 style="margin-top:2em;"><?php esc_html_e( 'Highlights', 'wp_subscription' ); ?></h2>
400 + <h2 style="margin-top:2em;"><?php esc_html_e( 'Highlights', 'subscription' ); ?></h2>
560 401 <div class="wpsubscription-features-grid">
561 402 <div class="feature-box"><span class="dashicons dashicons-admin-generic"></span><h3>Easy Setup</h3><p>Get started in minutes with our intuitive onboarding wizard.</p></div>
562 403 <div class="feature-box"><span class="dashicons dashicons-money"></span><h3>Multiple Gateways</h3><p>Support for Stripe, PayPal, and Paddle out of the box.</p></div>
563 404 <div class="feature-box"><span class="dashicons dashicons-schedule"></span><h3>Flexible Plans</h3><p>Create and manage various subscription types and delivery schedules.</p></div>
@@ -605,9 +446,9 @@
605 446 <?php
606 447 }
607 448
608 449 public function render_go_pro_page() {
609 - if ( class_exists('Sdevs_Wc_Subscription_Pro') ) {
450 + if ( class_exists( 'Sdevs_Wc_Subscription_Pro' ) ) {
610 451 echo '<div class="notice notice-info" style="margin:40px auto;max-width:700px;text-align:center;font-size:1.2em;">Pro is already active.</div>';
611 452 return;
612 453 }
613 454 ?>
@@ -612,11 +453,11 @@
612 453 }
613 454 ?>
614 455 <div class="wrap wpsubscription-go-pro" style="max-width:900px;margin:40px auto 0 auto;">
615 456 <div class="wpsubscription-go-pro-card" style="background:#fff;border-radius:12px;box-shadow:0 2px 12px rgba(0,0,0,0.06);padding:40px 32px 32px 32px;">
616 - <h1 style="margin-bottom:0.5em;"><?php esc_html_e( 'Upgrade to WP Subscription Pro', 'wp_subscription' ); ?></h1>
457 + <h1 style="margin-bottom:0.5em;"><?php esc_html_e( 'Upgrade to WPSubscription Pro', 'subscription' ); ?></h1>
617 458 <p style="font-size:1.12em;max-width:600px;line-height:1.6;">
618 - <?php esc_html_e( 'Unlock the full power of subscriptions for WooCommerce. Get advanced features, priority support, and more ways to grow your recurring revenue.', 'wp_subscription' ); ?>
459 + <?php esc_html_e( 'Unlock the full power of subscriptions for WooCommerce. Get advanced features, priority support, and more ways to grow your recurring revenue.', 'subscription' ); ?>
619 460 </p>
620 461 <table class="wpsubscription-compare-table" style="width:100%;margin:32px 0 40px 0;border-collapse:separate;border-spacing:0;box-shadow:0 1px 4px rgba(0,0,0,0.04);background:#fafbfc;border-radius:8px;overflow:hidden;">
621 462 <thead>
622 463 <tr style="background:#f8f9fa;">
@@ -663,10 +504,10 @@
663 504 </tr>
664 505 </tbody>
665 506 </table>
666 507 <div style="text-align:center;margin-top:24px;">
667 - <a href="https://wpsubscription.co/" target="_blank" class="button button-primary button-hero" style="font-size:1.2em;padding:16px 40px 16px 40px;background:#7f54b3;border:none;box-shadow:0 2px 8px rgba(127,84,179,0.10);">
668 - <?php esc_html_e( 'Upgrade to Pro', 'wp_subscription' ); ?>
508 + <a href="https://wpsubscription.co/?utm_source=plugin&utm_medium=admin&utm_campaign=upgrade_pro" target="_blank" class="button button-primary button-hero" style="font-size:1.2em;padding:16px 40px 16px 40px;background:#7f54b3;border:none;box-shadow:0 2px 8px rgba(127,84,179,0.10);">
509 + <?php esc_html_e( 'Upgrade to Pro', 'subscription' ); ?>
669 510 </a>
670 511 </div>
671 512 </div>
672 513 </div>