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/Frontend/MyAccount.php +12 -12 1.9.52.0.0 View file →
@@ -75,11 +75,13 @@
75 75
76 76 /**
77 77 * Display Subscription Content.
78 78 *
79 - * @param Int $id Post ID.
79 + * @param int $id Post ID.
80 80 */
81 - public function view_subscrpt_content( int $id ) {
81 + public function view_subscrpt_content( $id ) {
82 + $id = absint( $id ); // typecast to int.
83 +
82 84 $subs_post = get_post( $id );
83 85 $author_id = $subs_post ? (int) $subs_post->post_author : 0;
84 86 $current_user_id = get_current_user_id();
85 87 $user_is_admin = current_user_can( 'manage_options' );
@@ -115,18 +117,15 @@
115 117
116 118 $trial = get_post_meta( $id, '_subscrpt_trial', true );
117 119 $trial_mode = get_post_meta( $id, '_subscrpt_trial_mode', true );
118 120
119 - $price = $subscription_data['price'] ?? 0;
120 - $price_excl_tax = (float) $order_item->get_total();
121 - $tax_amount = (float) $order_item->get_total_tax();
121 + // Undiscounted subtotal, the discount that recurs, tax on the discounted amount, and the renewal total.
122 + $display_totals = Helper::get_subscription_display_totals( $id, $order_item );
122 123
123 - if ( $tax_amount > 0 ) {
124 - $price = $price_excl_tax + $tax_amount;
125 - $price = number_format( (float) $price, 2, '.', '' );
126 - } else {
127 - $tax_amount = 0;
128 - }
124 + $price = $display_totals['total'];
125 + $price_excl_tax = $display_totals['full_excl'];
126 + $tax_amount = $display_totals['tax'];
127 + $discount = $display_totals['discount'];
129 128
130 129 $is_grace_period = isset( $subscription_data['grace_period'] );
131 130 $grace_remaining = $subscription_data['grace_period']['remaining_days'] ?? 0;
132 131 $grace_end_date = $subscription_data['grace_period']['end_date'] ?? '';
@@ -231,8 +230,9 @@
231 230 'related_orders' => $related_orders,
232 231 'price' => $price,
233 232 'price_excl_tax' => $price_excl_tax,
234 233 'tax' => $tax_amount,
234 + 'discount' => $discount,
235 235 'user_cancel' => $user_cancel,
236 236 'action_buttons' => $action_buttons,
237 237 'wp_button_class' => wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '',
238 238 ),
@@ -305,9 +305,9 @@
305 305 'author' => get_current_user_id(),
306 306 'posts_per_page' => 10,
307 307 'paged' => $current_page,
308 308 'post_type' => 'subscrpt_order',
309 - 'post_status' => array( 'pending', 'active', 'on_hold', 'cancelled', 'expired', 'pe_cancelled' ),
309 + 'post_status' => array( 'pending', 'active', 'on_hold', 'cancelled', 'expired', 'pe_cancelled', 'completed' ),
310 310 );
311 311
312 312 $postslist = new \WP_Query( $args );
313 313 wc_get_template(