/subscription/myaccount/subscriptions.php
*/
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
|
|
|
|
|
Actions |
have_posts() ) :
while ( $postslist->have_posts() ) :
$postslist->the_post();
$subscription_id = get_the_ID();
$subscription_data = SpringDevs\Subscription\Illuminate\Helper::get_subscription_data( $subscription_id );
if ( ! $subscription_data ) {
continue;
}
$subscrpt_status = $subscription_data['status'] ?? '';
$verbose_status = SpringDevs\Subscription\Illuminate\Helper::get_verbose_status( $subscrpt_status );
$order_id = $subscription_data['order']['order_id'] ?? 0;
$order_item_id = $subscription_data['order']['order_item_id'] ?? 0;
$order = wc_get_order( $order_id );
$order_item = $order ? $order->get_item( $order_item_id ) : null;
if ( ! $order || ! $order_item ) {
subscrpt_write_log( sprintf( 'Order or order item not found for subscription #%d', $subscription_id ) );
continue;
}
$product_id = $subscription_data['product']['product_id'] ?? 0;
$product_name = $order_item->get_name();
$start_date = $subscription_data['start_date'] ?? '';
$start_date = ! empty( $start_date ) ? wp_date( 'F j, Y', strtotime( $start_date ) ) : '-';
$next_date = $subscription_data['next_date'] ?? '';
$next_date = ! empty( $next_date ) ? wp_date( 'F j, Y', strtotime( $next_date ) ) : '-';
$trial = get_post_meta( get_the_ID(), '_subscrpt_trial', true );
$trial_mode = get_post_meta( get_the_ID(), '_subscrpt_trial_mode', true );
$trial_mode = empty( $trial_mode ) ? 'off' : $trial_mode;
$quantity = (int) $order_item->get_quantity();
$price = (float) ( $subscription_data['price'] ?? 0 ) * max( 1, $quantity );
$price_excl_tax = (float) $order_item->get_total();
$tax_amount = (float) $order_item->get_total_tax();
if ( $tax_amount > 0 ) {
$price = $price_excl_tax + $tax_amount;
$price = number_format( (float) $price, 2, '.', '' );
}
$product_price_html = SpringDevs\Subscription\Illuminate\Helper::format_price_with_order_item( $price, $order_item->get_id() );
$is_grace_period = isset( $subscription_data['grace_period'] );
$grace_remaining = $subscription_data['grace_period']['remaining_days'] ?? 0;
$my_account_page_id = get_option( 'woocommerce_myaccount_page_id' );
$my_account_url = get_permalink( $my_account_page_id );
$view_sub_endpoint = SpringDevs\Subscription\Illuminate\Subscription\Subscription::get_user_endpoint( 'view_subs' );
$view_sub_url = wc_get_endpoint_url( $view_sub_endpoint, get_the_ID(), $my_account_url );
?>
|
0 ) : ?>
Active
9 ? substr( $verbose_status, 0, 9 ) . '...' : $verbose_status ); ?>
|
|
|
First Billing : |
|
|
|
|
max_num_pages ) : ?>