ID, '_subscrpt_order_id', true );
$order = wc_get_order( $order_id );
$order_item_id = get_post_meta( $post->ID, '_subscrpt_order_item_id', true );
$order_item = $order ? $order->get_item( $order_item_id ) : null;
$product_name = $order_item ? $order_item->get_name() : '-';
$cost = $order_item ? SpringDevs\Subscription\Illuminate\Helper::format_price_with_order_item( get_post_meta( $post->ID, '_subscrpt_price', true ), $order_item_id ) : '-';
$qty = $order_item ? 'x' . $order_item->get_quantity() : '-';
$customer = $order ? $order->get_formatted_billing_full_name() : '-';
$customer_id = $order ? $order->get_customer_id() : 0;
$customer_url = $customer_id ? admin_url( 'user-edit.php?user_id=' . $customer_id ) : '';
$start_date = get_post_meta( $post->ID, '_subscrpt_start_date', true );
$end_date = get_post_meta( $post->ID, '_subscrpt_end_date', true );
$renewal_date = get_post_meta( $post->ID, '_subscrpt_next_date', true );
$status_obj = get_post_status_object( get_post_status( $post->ID ) );
$payment_method = $order ? $order->get_payment_method_title() : '-';
$billing_address = $order ? $order->get_formatted_billing_address() : '-';
$shipping_address = $order ? $order->get_formatted_shipping_address() : '-';
?>
| Product |
|
| Cost |
|
| Qty |
|
ID, '_subscrpt_product_id', true );
$max_payments = subscrpt_get_max_payments( $post->ID ) ?: 0;
// Get payment type information first (needed for condition)
$payment_type = $product_id ? get_post_meta( $product_id, '_subscrpt_payment_type', true ) : 'recurring';
$payment_type = $payment_type ?: 'recurring'; // Default to recurring if empty
// Also check subscription's own meta data
$subscription_payment_type = get_post_meta( $post->ID, '_subscrpt_payment_type', true );
$subscription_max_payments = get_post_meta( $post->ID, '_subscrpt_max_no_payment', true );
// Also check if this subscription has variation data
$variation_id = get_post_meta( $post->ID, '_subscrpt_variation_id', true );
if ( $variation_id ) {
$variation_payment_type = get_post_meta( $variation_id, '_subscrpt_payment_type', true );
$variation_max_payments = get_post_meta( $variation_id, '_subscrpt_max_no_payment', true );
// Use variation data if product data is not available
if ( empty( $payment_type ) || 'recurring' === $payment_type ) {
if ( ! empty( $variation_payment_type ) ) {
$payment_type = $variation_payment_type;
}
}
if ( ! $max_payments && ! empty( $variation_max_payments ) ) {
$max_payments = $variation_max_payments;
}
}
// Use subscription's own data if available and more specific
if ( ! empty( $subscription_payment_type ) ) {
$payment_type = $subscription_payment_type;
}
if ( ! empty( $subscription_max_payments ) ) {
$max_payments = $subscription_max_payments;
}
// Final fallback: Infer payment type from max_payments if not explicitly set
if ( ( empty( $payment_type ) || 'recurring' === $payment_type ) && $max_payments > 0 ) {
$payment_type = 'split_payment';
}
// Ensure max_payments is properly set for display
$max_payments = (int) $max_payments;
// Show Total Payments if conditions are met
if ( ( ! empty( $max_payments ) && $max_payments > 0 ) || ( 'split_payment' === $payment_type && $max_payments > 0 ) ) :
$payments_made = subscrpt_count_payments_made( $post->ID );
?>
|
|
ID, '_subscrpt_payment_type', true );
$subscription_max_payments = get_post_meta( $post->ID, '_subscrpt_max_no_payment', true );
// Also check if this subscription has variation data
$variation_id = get_post_meta( $post->ID, '_subscrpt_variation_id', true );
if ( $variation_id ) {
$variation_payment_type = get_post_meta( $variation_id, '_subscrpt_payment_type', true );
$variation_max_payments = get_post_meta( $variation_id, '_subscrpt_max_no_payment', true );
// Use variation data if product data is not available
if ( empty( $payment_type ) || 'recurring' === $payment_type ) {
if ( ! empty( $variation_payment_type ) ) {
$payment_type = $variation_payment_type;
}
}
if ( ! $max_payments && ! empty( $variation_max_payments ) ) {
$max_payments = $variation_max_payments;
}
}
// Use subscription's own data if available and more specific
if ( ! empty( $subscription_payment_type ) ) {
$payment_type = $subscription_payment_type;
}
if ( ! empty( $subscription_max_payments ) ) {
$max_payments = $subscription_max_payments;
}
// Final fallback: Infer payment type from max_payments if not explicitly set
if ( ( empty( $payment_type ) || 'recurring' === $payment_type ) && $max_payments > 0 ) {
$payment_type = 'split_payment';
}
// Ensure max_payments is properly set for display
$max_payments = (int) $max_payments;
?>
|
|
0 ) : ?>
ID );
}
}
?>
|
|
|
|
| Started date |
|
| Payment due date |
|
| Status |
label ); ?> |
| Payment Method |
|