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 -13 1.10.42.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,19 +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 - $quantity = (int) $order_item->get_quantity();
120 - $price = (float) ( $subscription_data['price'] ?? 0 ) * max( 1, $quantity );
121 - $price_excl_tax = (float) $order_item->get_total();
122 - $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 );
123 123
124 - if ( $tax_amount > 0 ) {
125 - $price = $price_excl_tax + $tax_amount;
126 - $price = number_format( (float) $price, 2, '.', '' );
127 - } else {
128 - $tax_amount = 0;
129 - }
124 + $price = $display_totals['total'];
125 + $price_excl_tax = $display_totals['full_excl'];
126 + $tax_amount = $display_totals['tax'];
127 + $discount = $display_totals['discount'];
130 128
131 129 $is_grace_period = isset( $subscription_data['grace_period'] );
132 130 $grace_remaining = $subscription_data['grace_period']['remaining_days'] ?? 0;
133 131 $grace_end_date = $subscription_data['grace_period']['end_date'] ?? '';
@@ -232,8 +230,9 @@
232 230 'related_orders' => $related_orders,
233 231 'price' => $price,
234 232 'price_excl_tax' => $price_excl_tax,
235 233 'tax' => $tax_amount,
234 + 'discount' => $discount,
236 235 'user_cancel' => $user_cancel,
237 236 'action_buttons' => $action_buttons,
238 237 'wp_button_class' => wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '',
239 238 ),
@@ -306,9 +305,9 @@
306 305 'author' => get_current_user_id(),
307 306 'posts_per_page' => 10,
308 307 'paged' => $current_page,
309 308 'post_type' => 'subscrpt_order',
310 - 'post_status' => array( 'pending', 'active', 'on_hold', 'cancelled', 'expired', 'pe_cancelled' ),
309 + 'post_status' => array( 'pending', 'active', 'on_hold', 'cancelled', 'expired', 'pe_cancelled', 'completed' ),
311 310 );
312 311
313 312 $postslist = new \WP_Query( $args );
314 313 wc_get_template(