/subscription/myaccount/subscriptions.php
*/
use SpringDevs\Subscription\Illuminate\Helper;
use SpringDevs\Subscription\Illuminate\Subscription\Subscription;
// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
?>
|
|
|
|
|
|
have_posts() ) :
while ( $postslist->have_posts() ) :
$postslist->the_post();
$subscription_id = get_the_ID();
$subscription_data = Helper::get_subscription_data( $subscription_id );
if ( ! $subscription_data ) {
continue;
}
$subscrpt_status = $subscription_data['status'] ?? '';
$verbose_status = 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 ) && SpringDevs\Subscription\Illuminate\Helper::has_next_payment( $subscrpt_status ) ? 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;
// Renewal total, already net of any discount that recurs.
$display_totals = Helper::get_subscription_display_totals( $subscription_id, $order_item );
$price = $display_totals['total'];
$product_price_html = 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 = Subscription::get_user_endpoint( 'view_subs' );
$view_sub_url = wc_get_endpoint_url( $view_sub_endpoint, get_the_ID(), $my_account_url );
?>
|
0 ) : ?>
9 ? mb_substr( $verbose_status, 0, 9 ) . '...' : $verbose_status ); ?>
|
|
|
|
|
|
|
|
max_num_pages ) : ?>