PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 2.2.0
Subscriptions for WooCommerce with Stripe Recurring Payments v2.2.0
2.4.0 2.3.0 2.2.0 2.1.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 All 65 releases
← All changes | templates/myaccount/single.php +66 -10 1.9.5 → 2.2.0 View file →
@@ -16,8 +16,12 @@
16 16 * @var string $status
17 17 * @var array $action_buttons
18 18 * @var bool $is_grace_period
19 19 * @var int $grace_remaining
20 + * @var float $price Renewal total, after any discount that recurs.
21 + * @var float $price_excl_tax Renewal subtotal before discount and tax.
22 + * @var float $tax Tax on the discounted renewal amount.
23 + * @var float $discount Discount that applies to each renewal. 0 when none recurs.
20 24 *
21 25 * This template can be overridden by copying it to <your_theme>/subscription/myaccount/single.php
22 26 *
23 27 * @package SpringDevs\Subscription
@@ -45,8 +49,14 @@
45 49 display: flex;
46 50 flex-wrap: wrap;
47 51 gap: 10px;
48 52 }
53 + .product-name .subscrpt-plan-term {
54 + display: block;
55 + margin-top: 4px;
56 + font-size: 13px;
57 + color: #6b7280;
58 + }
49 59 </style>
50 60 <table class="woocommerce-table woocommerce-table--order-details shop_table order_details subscription_details">
51 61 <tbody>
52 62 <tr>
@@ -56,9 +66,9 @@
56 66 <tr>
57 67 <td><?php esc_html_e( 'Status', 'subscription' ); ?></td>
58 68 <td>
59 69 <?php if ( $is_grace_period && $grace_remaining > 0 ) : ?>
60 - <span class="subscrpt-active grace-active">
70 + <span class="subscrpt-legacy-status subscrpt-legacy-status--active grace-active">
61 71 Active
62 72
63 73 <?php
64 74 $grace_remaining_text = sprintf(
@@ -71,9 +81,9 @@
71 81 <span class="dashicons dashicons-warning"></span>
72 82 </span>
73 83 </span>
74 84 <?php else : ?>
75 - <span class="subscrpt-<?php echo esc_attr( strtolower( $status ) ); ?>">
85 + <span class="subscrpt-legacy-status subscrpt-legacy-status--<?php echo esc_attr( strtolower( $status ) ); ?>">
76 86 <?php echo esc_html( $verbose_status ); ?>
77 87 </span>
78 88 <?php endif; ?>
79 89 </td>
@@ -105,9 +115,9 @@
105 115 ?>
106 116 </td>
107 117 <td><?php echo esc_html( $start_date ); ?></td>
108 118 </tr>
109 - <?php if ( null == $trial || in_array( $trial_mode, array( 'off', 'extended' ), true ) ) : ?>
119 + <?php if ( ( null == $trial || in_array( $trial_mode, array( 'off', 'extended' ), true ) ) && get_post_meta( $id, '_subscrpt_next_date', true ) ) : ?>
110 120 <tr>
111 121 <td>
112 122 <?php
113 123 esc_html_e( 'Next payment date', 'subscription' );
@@ -199,11 +209,14 @@
199 209
200 210 <!-- Access Duration Information for Split Payments -->
201 211 <?php if ( 'split_payment' === $payment_type && $max_payments > 0 ) : ?>
202 212 <?php
203 - $access_ends_timing = get_post_meta( $product_id, '_subscrpt_access_ends_timing', true ) ?: 'after_full_duration';
204 - $custom_duration_time = get_post_meta( $product_id, '_subscrpt_custom_access_duration_time', true ) ?: 1;
205 - $custom_duration_type = get_post_meta( $product_id, '_subscrpt_custom_access_duration_type', true ) ?: 'months';
213 + // Plan subscriptions store access-ends on the subscription; classic ones on
214 + // the product. Prefer the subscription meta, fall back to the product.
215 + $access_ends_timing = get_post_meta( $id, '_subscrpt_access_ends_timing', true );
216 + $access_ends_timing = $access_ends_timing ? $access_ends_timing : ( get_post_meta( $product_id, '_subscrpt_access_ends_timing', true ) ?: 'after_full_duration' );
217 + $custom_duration_time = get_post_meta( $id, '_subscrpt_custom_access_duration_time', true ) ?: ( get_post_meta( $product_id, '_subscrpt_custom_access_duration_time', true ) ?: 1 );
218 + $custom_duration_type = get_post_meta( $id, '_subscrpt_custom_access_duration_type', true ) ?: ( get_post_meta( $product_id, '_subscrpt_custom_access_duration_type', true ) ?: 'months' );
206 219
207 220 // Calculate access end date if Pro version is available
208 221 $access_end_date_string = null;
209 222 if ( function_exists( 'subscrpt_pro_activated' ) && subscrpt_pro_activated() ) {
@@ -296,13 +309,21 @@
296 309 <tr class="order_item">
297 310 <td class="product-name">
298 311 <a href="<?php echo esc_html( $product_link ); ?>"><?php echo esc_html( $product_name ); ?></a>
299 312 <strong class="product-quantity">× <?php echo esc_html( $order_item->get_quantity() ); ?></strong>
313 + <?php
314 + $plan_label = function_exists( 'subscrpt_get_subscription_plan_label' ) ? subscrpt_get_subscription_plan_label( $id ) : '';
315 + if ( $plan_label ) :
316 + ?>
317 + <span class="subscrpt-plan-term"><?php printf( /* translators: %s: plan name. */ esc_html__( 'Plan: %s', 'subscription' ), esc_html( $plan_label ) ); ?></span>
318 + <?php endif; ?>
300 319 </td>
301 320 <td class="product-total">
302 321 <span class="woocommerce-Price-amount amount">
303 322 <?php
304 - echo wp_kses_post( Helper::format_price_with_order_item( get_post_meta( $id, '_subscrpt_price', true ), $order_item->get_id() ) );
323 + $unit_price = (float) get_post_meta( $id, '_subscrpt_price', true );
324 + $display_price = $unit_price * max( 1, (int) $order_item->get_quantity() );
325 + echo wp_kses_post( Helper::format_price_with_order_item( $display_price, $order_item->get_id() ) );
305 326 ?>
306 327 </span>
307 328 </td>
308 329 </tr>
@@ -316,8 +337,24 @@
316 337 </span>
317 338 </td>
318 339 </tr>
319 340
341 + <?php if ( ! empty( $discount ) && $discount > 0 ) : ?>
342 + <tr class="subscrpt-recurring-discount">
343 + <th scope="row"><?php esc_html_e( 'Discount', 'subscription' ); ?>:</th>
344 + <td>
345 + <span class="woocommerce-Price-amount amount">
346 + <?php
347 + printf(
348 + '-%s',
349 + wp_kses_post( wc_price( $discount, array( 'currency' => $order->get_currency() ) ) )
350 + );
351 + ?>
352 + </span>
353 + </td>
354 + </tr>
355 + <?php endif; ?>
356 +
320 357 <?php if ( $tax > 0 ) : ?>
321 358 <tr>
322 359 <th scope="row"><?php esc_html_e( 'Tax', 'subscription' ); ?>:</th>
323 360 <td>
@@ -341,13 +378,28 @@
341 378
342 379 <?php do_action( 'subscrpt_after_subscription_totals', (int) $id ); ?>
343 380
344 381 <!-- Show related subscription orders -->
382 +<?php
383 +/*
384 + * Sequence number within this subscription: 1 = first (parent) order, then each
385 + * renewal in order. Helper::get_related_orders() returns newest-first, so the
386 + * map is built from the reversed list. Relations whose order no longer exists
387 + * are skipped here as well, keeping the numbering gapless with the rendered rows.
388 + */
389 +$related_order_seq = [];
390 +foreach ( array_reverse( $related_orders ) as $subscrpt_relation ) {
391 + if ( isset( $related_order_seq[ $subscrpt_relation->order_id ] ) || ! wc_get_order( $subscrpt_relation->order_id ) ) {
392 + continue;
393 + }
394 + $related_order_seq[ $subscrpt_relation->order_id ] = count( $related_order_seq ) + 1;
395 +}
396 +?>
345 397 <h2><?php echo esc_html_e( 'Related Orders', 'subscription' ); ?></h2>
346 398 <table class="woocommerce-table woocommerce-table--order-details shop_table order_details">
347 399 <thead>
348 400 <tr>
349 - <th class="order-number"><?php echo esc_html_e( 'Order', 'subscription' ); ?></th>
401 + <th class="order-number"><?php echo esc_html_e( '#', 'subscription' ); ?></th>
350 402 <th class="order-type"><?php echo esc_html_e( 'Type', 'subscription' ); ?></th>
351 403 <th class="order-date"><?php echo esc_html_e( 'Date', 'subscription' ); ?></th>
352 404 <th class="order-status"><?php echo esc_html_e( 'Status', 'subscription' ); ?></th>
353 405 <th class="order-total"><?php echo esc_html_e( 'Total', 'subscription' ); ?></th>
@@ -383,10 +435,14 @@
383 435 ?>
384 436
385 437 <tr class="order_item">
386 438 <td class="order-number">
387 - <a href="<?php echo esc_url( wc_get_endpoint_url( 'view-order', $order_id, wc_get_page_permalink( 'myaccount' ) ) ); ?>">
388 - #<?php echo esc_html( $order_id ); ?>
439 + <?php
440 + // translators: %s: WooCommerce order number.
441 + $order_number_label = sprintf( __( 'Order #%s', 'subscription' ), $order->get_order_number() );
442 + ?>
443 + <a href="<?php echo esc_url( wc_get_endpoint_url( 'view-order', $order_id, wc_get_page_permalink( 'myaccount' ) ) ); ?>" title="<?php echo esc_attr( $order_number_label ); ?>" aria-label="<?php echo esc_attr( $order_number_label ); ?>">
444 + <?php echo esc_html( number_format_i18n( $related_order_seq[ $order_id ] ?? 0 ) ); ?>
389 445 </a>
390 446 </td>
391 447 <td class="order-type">
392 448 <?php echo esc_html( $order_type_label ); ?>