Advertisement
nshelper

WPGlobalCart - WooCommerce Subscriptions - Template file

Sep 6th, 2024
51
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.67 KB | None | 0 0
  1. <?php
  2. /**
  3.  * My Subscriptions section on the My Account page
  4.  *
  5.  * @author   Prospress
  6.  * @category WooCommerce Subscriptions/Templates
  7.  * @version  7.2.0 - Migrated from WooCommerce Subscriptions v2.6.4
  8.  */
  9.  
  10. if ( ! defined( 'ABSPATH' ) ) {
  11.     exit; // Exit if accessed directly
  12. }
  13. ?>
  14. <div class="woocommerce_account_subscriptions">
  15.  
  16.     <?php if ( ! empty( $subscriptions ) ) : ?>
  17.     <table class="my_account_subscriptions my_account_orders woocommerce-orders-table woocommerce-MyAccount-subscriptions shop_table shop_table_responsive woocommerce-orders-table--subscriptions">
  18.  
  19.     <thead>
  20.         <tr>
  21.             <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>
  22.             <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>
  23.             <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>
  24.             <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>
  25.             <th class="subscription-actions order-actions woocommerce-orders-table__header woocommerce-orders-table__header-order-actions woocommerce-orders-table__header-subscription-actions">&nbsp;</th>
  26.         </tr>
  27.     </thead>
  28.  
  29.     <tbody>
  30.     <?php /** @var WC_Subscription $subscription */ ?>
  31.     <?php
  32.     foreach ( $subscriptions as $subscription_id => $subscription ) : ?>
  33.         <?php do_action( 'woocommerce/cart_loop/start', $subscription ); ?>
  34.         <tr class="order woocommerce-orders-table__row woocommerce-orders-table__row--status-<?php echo esc_attr( $subscription->get_status() ); ?>">
  35.             <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' ); ?>">
  36.                 <?php // translators: placeholder is a subscription number. ?>
  37.                 <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() ) ) ?>">
  38.                     <?php echo esc_html( sprintf( _x( '#%s', 'hash before order number', 'woocommerce-subscriptions' ), $subscription->get_order_number() ) ); ?>
  39.                 </a>
  40.                 <?php do_action( 'woocommerce_my_subscriptions_after_subscription_id', $subscription ); ?>
  41.             </td>
  42.             <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' ); ?>">
  43.                 <?php echo esc_attr( wcs_get_subscription_status_name( $subscription->get_status() ) ); ?>
  44.             </td>
  45.             <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' ); ?>">
  46.                 <?php echo esc_attr( $subscription->get_date_to_display( 'next_payment' ) ); ?>
  47.                 <?php if ( ! $subscription->is_manual() && $subscription->has_status( 'active' ) && $subscription->get_time( 'next_payment' ) > 0 ) : ?>
  48.                 <br/><small><?php echo esc_attr( $subscription->get_payment_method_to_display( 'customer' ) ); ?></small>
  49.                 <?php endif; ?>
  50.             </td>
  51.             <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' ); ?>">
  52.                 <?php echo wp_kses_post( $subscription->get_formatted_order_total() ); ?>
  53.             </td>
  54.             <td class="subscription-actions order-actions woocommerce-orders-table__cell woocommerce-orders-table__cell-subscription-actions woocommerce-orders-table__cell-order-actions">
  55.                 <a href="<?php echo esc_url( $subscription->get_view_order_url() ) ?>" class="woocommerce-button button view"><?php echo esc_html_x( 'View', 'view a subscription', 'woocommerce-subscriptions' ); ?></a>
  56.                 <?php do_action( 'woocommerce_my_subscriptions_actions', $subscription ); ?>
  57.             </td>
  58.         </tr>
  59.         <?php do_action( 'woocommerce/cart_loop/end', $subscription ); ?>
  60.     <?php endforeach; ?>
  61.     </tbody>
  62.  
  63.     </table>
  64.         <?php if ( 1 < $max_num_pages ) : ?>
  65.             <div class="woocommerce-pagination woocommerce-pagination--without-numbers woocommerce-Pagination">
  66.             <?php if ( 1 !== $current_page ) : ?>
  67.                 <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>
  68.             <?php endif; ?>
  69.  
  70.             <?php if ( intval( $max_num_pages ) !== $current_page ) : ?>
  71.                 <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>
  72.             <?php endif; ?>
  73.             </div>
  74.         <?php endif; ?>
  75.     <?php else : ?>
  76.         <p class="no_subscriptions woocommerce-message woocommerce-message--info woocommerce-Message woocommerce-Message--info woocommerce-info">
  77.             <?php if ( 1 < $current_page ) :
  78.                 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>' );
  79.             else :
  80.                 esc_html_e( 'You have no active subscriptions.', 'woocommerce-subscriptions' );
  81.                 ?>
  82.                 <a class="woocommerce-Button button" href="<?php echo esc_url( apply_filters( 'woocommerce_return_to_shop_redirect', wc_get_page_permalink( 'shop' ) ) ); ?>">
  83.                     <?php esc_html_e( 'Browse products', 'woocommerce-subscriptions' ); ?>
  84.                 </a>
  85.             <?php
  86.         endif; ?>
  87.         </p>
  88.  
  89.     <?php endif; ?>
  90.  
  91. </div>
Advertisement
Comments
  • nshelper
    39 days
    # text 0.11 KB | 0 0
    1. Copy the my-subscriptions.php from plugin template folder to theme/woocommerce/myaccount/my-subscriptions.php
Add Comment
Please, Sign In to add comment
Advertisement