Advertisement
nshelper

Untitled

May 30th, 2025
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.91 KB | None | 0 0
  1. <?php
  2.  
  3. /**
  4.  
  5. * My Subscriptions section on the My Account page
  6.  
  7. *
  8.  
  9. * @author Prospress
  10.  
  11. * @category WooCommerce Subscriptions/Templates
  12.  
  13. * @version 7.2.0 - Migrated from WooCommerce Subscriptions v2.6.4
  14.  
  15. * ORIGINAL TEMPLATE FILE LOCATION: \wp-content\plugins\woocommerce-subscriptions\vendor\woocommerce\subscriptions-core\templates\myaccount/my-subscriptions.php
  16.  
  17. */
  18.  
  19.  
  20.  
  21. if ( ! defined( 'ABSPATH' ) ) {
  22.  
  23. exit; // Exit if accessed directly
  24.  
  25. }
  26.  
  27. ?>
  28.  
  29. <div class="woocommerce_account_subscriptions">
  30.  
  31.  
  32.  
  33. <?php if ( ! empty( $subscriptions ) ) : ?>
  34.  
  35. <table class="my_account_subscriptions my_account_orders woocommerce-orders-table woocommerce-MyAccount-subscriptions shop_table shop_table_responsive woocommerce-orders-table--subscriptions">
  36.  
  37.  
  38.  
  39. <thead>
  40.  
  41. <tr>
  42.  
  43. <th class="subscription-id order-number woocommerce-orders-table__header woocommerce-orders-table__header-order-number woocommerce-orders-table__header-subscription-id"><span class="nobr"><?php esc_html_e( 'Subscription', 'woocommerce-subscriptions' ); ?></span></th>
  44.  
  45. <th class="subscription-status order-status woocommerce-orders-table__header woocommerce-orders-table__header-order-status woocommerce-orders-table__header-subscription-status"><span class="nobr"><?php esc_html_e( 'Status', 'woocommerce-subscriptions' ); ?></span></th>
  46.  
  47. <th class="subscription-next-payment order-date woocommerce-orders-table__header woocommerce-orders-table__header-order-date woocommerce-orders-table__header-subscription-next-payment"><span class="nobr"><?php echo esc_html_x( 'Next payment', 'table heading', 'woocommerce-subscriptions' ); ?></span></th>
  48.  
  49. <th class="subscription-total order-total woocommerce-orders-table__header woocommerce-orders-table__header-order-total woocommerce-orders-table__header-subscription-total"><span class="nobr"><?php echo esc_html_x( 'Total', 'table heading', 'woocommerce-subscriptions' ); ?></span></th>
  50.  
  51. <th class="subscription-actions order-actions woocommerce-orders-table__header woocommerce-orders-table__header-order-actions woocommerce-orders-table__header-subscription-actions">&nbsp;</th>
  52.  
  53. </tr>
  54.  
  55. </thead>
  56.  
  57.  
  58.  
  59. <tbody>
  60.  
  61. <?php /** @var WC_Subscription $subscription */ ?>
  62.  
  63. <?php foreach ( $subscriptions as $subscription_id => $subscription ) : ?>
  64. <?php do_action( 'woocommerce/cart_loop/start', $subscription ); ?>
  65. <tr class="order woocommerce-orders-table__row woocommerce-orders-table__row--status-<?php echo esc_attr( $subscription->get_status() ); ?>">
  66.  
  67. <td class="subscription-id order-number woocommerce-orders-table__cell woocommerce-orders-table__cell-subscription-id woocommerce-orders-table__cell-order-number" data-title="<?php esc_attr_e( 'ID', 'woocommerce-subscriptions' ); ?>">
  68.  
  69. <?php // translators: placeholder is a subscription number. ?>
  70.  
  71. <a href="<?php echo esc_url( $subscription->get_view_order_url() ); ?>" aria-label="<?php echo esc_attr( sprintf( __( 'View subscription number %s', 'woocommerce-subscriptions' ), $subscription->get_order_number() ) ) ?>">
  72.  
  73. <?php echo esc_html( sprintf( _x( '#%s', 'hash before order number', 'woocommerce-subscriptions' ), $subscription->get_order_number() ) ); ?>
  74.  
  75. </a>
  76.  
  77. <?php do_action( 'woocommerce_my_subscriptions_after_subscription_id', $subscription ); ?>
  78.  
  79. </td>
  80.  
  81. <td class="subscription-status order-status woocommerce-orders-table__cell woocommerce-orders-table__cell-subscription-status woocommerce-orders-table__cell-order-status" data-title="<?php esc_attr_e( 'Status', 'woocommerce-subscriptions' ); ?>">
  82.  
  83. <?php echo esc_attr( wcs_get_subscription_status_name( $subscription->get_status() ) ); ?>
  84.  
  85. </td>
  86.  
  87. <td class="subscription-next-payment order-date woocommerce-orders-table__cell woocommerce-orders-table__cell-subscription-next-payment woocommerce-orders-table__cell-order-date" data-title="<?php echo esc_attr_x( 'Next Payment', 'table heading', 'woocommerce-subscriptions' ); ?>">
  88.  
  89. <?php echo esc_attr( $subscription->get_date_to_display( 'next_payment' ) ); ?>
  90.  
  91. <?php if ( ! $subscription->is_manual() && $subscription->has_status( 'active' ) && $subscription->get_time( 'next_payment' ) > 0 ) : ?>
  92.  
  93. <br/><small><?php echo esc_attr( $subscription->get_payment_method_to_display( 'customer' ) ); ?></small>
  94.  
  95. <?php endif; ?>
  96.  
  97. </td>
  98.  
  99. <td class="subscription-total order-total woocommerce-orders-table__cell woocommerce-orders-table__cell-subscription-total woocommerce-orders-table__cell-order-total" data-title="<?php echo esc_attr_x( 'Total', 'Used in data attribute. Escaped', 'woocommerce-subscriptions' ); ?>">
  100.  
  101. <?php echo wp_kses_post( $subscription->get_formatted_order_total() ); ?>
  102.  
  103. </td>
  104.  
  105. <td class="subscription-actions order-actions woocommerce-orders-table__cell woocommerce-orders-table__cell-subscription-actions woocommerce-orders-table__cell-order-actions">
  106.  
  107. <a href="<?php echo esc_url( $subscription->get_view_order_url() ) ?>" class="woocommerce-button button view<?php echo esc_attr( wc_wp_theme_get_element_class_name( 'button' ) ? ' ' . wc_wp_theme_get_element_class_name( 'button' ) : '' ); ?>"><?php echo esc_html_x( 'View', 'view a subscription', 'woocommerce-subscriptions' ); ?></a>
  108.  
  109. <?php do_action( 'woocommerce_my_subscriptions_actions', $subscription ); ?>
  110.  
  111. </td>
  112.  
  113. </tr>
  114. <?php do_action( 'woocommerce/cart_loop/end', $subscription ); ?>
  115. <?php endforeach; ?>
  116.  
  117. </tbody>
  118.  
  119.  
  120.  
  121. </table>
  122.  
  123. <?php if ( 1 < $max_num_pages ) : ?>
  124.  
  125. <div class="woocommerce-pagination woocommerce-pagination--without-numbers woocommerce-Pagination">
  126.  
  127. <?php if ( 1 !== $current_page ) : ?>
  128.  
  129. <a class="woocommerce-button woocommerce-button--previous woocommerce-Button woocommerce-Button--previous button" href="<?php echo esc_url( wc_get_endpoint_url( 'subscriptions', $current_page - 1 ) ); ?>"><?php esc_html_e( 'Previous', 'woocommerce-subscriptions' ); ?></a>
  130.  
  131. <?php endif; ?>
  132.  
  133.  
  134.  
  135. <?php if ( intval( $max_num_pages ) !== $current_page ) : ?>
  136.  
  137. <a class="woocommerce-button woocommerce-button--next woocommerce-Button woocommerce-Button--next button" href="<?php echo esc_url( wc_get_endpoint_url( 'subscriptions', $current_page + 1 ) ); ?>"><?php esc_html_e( 'Next', 'woocommerce-subscriptions' ); ?></a>
  138.  
  139. <?php endif; ?>
  140.  
  141. </div>
  142.  
  143. <?php endif; ?>
  144.  
  145. <?php else : ?>
  146.  
  147. <p class="no_subscriptions woocommerce-message woocommerce-message--info woocommerce-Message woocommerce-Message--info woocommerce-info">
  148.  
  149. <?php if ( 1 < $current_page ) :
  150.  
  151. printf( esc_html__( 'You have reached the end of subscriptions. Go to the %sfirst page%s.', 'woocommerce-subscriptions' ), '<a href="' . esc_url( wc_get_endpoint_url( 'subscriptions', 1 ) ) . '">', '</a>' );
  152.  
  153. else :
  154.  
  155. esc_html_e( 'You have no active subscriptions.', 'woocommerce-subscriptions' );
  156.  
  157. ?>
  158.  
  159. <a class="woocommerce-Button button" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
  160.  
  161. <?php esc_html_e( 'Browse products', 'woocommerce-subscriptions' ); ?>
  162.  
  163. </a>
  164.  
  165. <?php
  166.  
  167. endif; ?>
  168.  
  169. </p>
  170.  
  171.  
  172.  
  173. <?php endif; ?>
  174.  
  175.  
  176.  
  177. </div>
  178.  
  179.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement