cancel-subscription.php
4.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
<?php
/**
* The template for displaying the Cancel Subscription .
*
* This page template will display any functions hooked into the `homepage` action.
* By default this includes a variety of product displays and the page content itself. To change the order or toggle these components
* use the Homepage Control plugin.
* https://wordpress.org/plugins/homepage-control/
*
* Template name: Cancel Subscription
*
* @package storefront
*/
/*
* Created on : Mar 9, 2016, 9:15:42 AM
* Author: Tran Trong Thang
* Email: trantrongthang1207@gmail.com
* Skype: trantrongthang1207
*/
remove_filter('the_content', 'wpautop');
get_header();
?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php while (have_posts()) : the_post(); ?>
<?php
do_action('storefront_page_before');
?>
<?php
//get_template_part('content', 'page');
/*
do_action( 'cancelled_subscription', 16, '275_181' );
$subscriptions = WC_Subscriptions_Manager::get_users_subscriptions(get_current_user_id());
$subscription = wcs_get_subscription_from_key( '275_181' );
$subscription->update_status( 'cancelled' );
echo get_current_user_id();
print_r($subscription); */
$subscriptions = wcs_get_users_subscriptions(get_current_user_id());
foreach ($subscriptions as $key => $value) {
$actions = wcs_get_all_user_actions_for_subscription($value, get_current_user_id());
if ($value->post->post_status != 'wc-cancelled' && $value->post->post_status != 'wc-pending-cancel') {
$url = $actions['cancel']['url'];
break;
}
}
if ($url) {
$url = str_replace('change_subscription_to', 'cancelled_subscription', $url);
}
?>
<div class="bg2 page_cancel_subscription">
<header class="tv-header text-center">
<h1 itemprop="name" class="tv-title">cancel membership</h1>
</header>
<div class="col-w-310">
<h2 class="text-uppercase font20 robotobold">we'll be sorry to see you go</h2>
<form action="<?php echo $url ?>" method="post" >
<div class="text-left">
<ul class="nav nav-pills nav-stacked">
<li>
<input type="radio" name="cancel_reason" value="Dislike the product" class="required"/>
<label>
Dislike the product
</label>
</li>
<li>
<input type="radio" name="cancel_reason" value="Unsatisfied with your service"/>
<label>
Unsatisfied with your service
</label>
</li>
<li>
<input type="radio" name="cancel_reason" value="I am receiving too much REIZE"/>
<label>
I'm receiving too much REIZE
</label>
</li>
<li>
<input type = "radio" name = "cancel_reason" value = "I have stopped drinking energy drinks"/>
<label>
I've stopped drinking energy drinks
</label>
</li>
</ul>
<br/>
<div>
Other
<textarea name="cancel_other" class="cancel_other"></textarea>
</div>
<br/>
<br/>
</div>
<button class="button btnrow"><span>Quit the REIZE Club</span> <i class="fa fa-angle-right hide"></i></button>
</form>
<br/>
<a href="/my-account" class="btnbgnone btnrowleft robotobold_italic"><span>Nevermind, take me back to My Account</span> <i class="fa fa-angle-right hide"></i></a>
</div>
<div class="form-group clearfix"></div>
</div>
<?php
/**
* @hooked storefront_display_comments - 10
*/
do_action('storefront_page_after');
?>
<?php endwhile; // end of the loop. ?>
</main><!-- #main -->
</div><!-- #primary -->
<?php get_footer(); ?>