This commit is contained in:
Prospress Inc
2017-06-09 16:36:26 +02:00
committed by Remco Tolsma
parent 5e536ec717
commit b99eba2f79
51 changed files with 1413 additions and 642 deletions

View File

@@ -172,7 +172,11 @@ function wcs_get_users_subscriptions( $user_id = 0 ) {
) );
foreach ( $post_ids as $post_id ) {
$subscriptions[ $post_id ] = wcs_get_subscription( $post_id );
$subscription = wcs_get_subscription( $post_id );
if ( $subscription ) {
$subscriptions[ $post_id ] = $subscription;
}
}
}
@@ -282,7 +286,7 @@ function wcs_get_all_user_actions_for_subscription( $subscription, $user_id ) {
// Show button for subscriptions which can be cancelled and which may actually require cancellation (i.e. has a future payment)
$next_payment = $subscription->get_time( 'next_payment' );
if ( $subscription->can_be_updated_to( 'cancelled' ) && ! $subscription->is_one_payment() && ( $next_payment > 0 || ( $subscription->has_status( 'on-hold' ) && empty( $next_payment ) ) ) ) {
if ( $subscription->can_be_updated_to( 'cancelled' ) && ( ! $subscription->is_one_payment() && ( $subscription->has_status( 'on-hold' ) && empty( $next_payment ) ) || $next_payment > 0 ) ) {
$actions['cancel'] = array(
'url' => wcs_get_users_change_status_link( $subscription->get_id(), 'cancelled', $current_status ),
'name' => _x( 'Cancel', 'an action on a subscription', 'woocommerce-subscriptions' ),