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.0 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.7.0 3.7.1 3.7.2 3.7.3 3.7.4 3.8.0 3.8.1 3.8.2 3.8.3 3.9.0 3.9.1 3.9.10 3.9.2 3.9.3 3.9.4 3.9.5 3.9.6 3.9.7 3.9.8 3.9.9
tutor / templates / ecommerce / checkout.php
tutor / templates / ecommerce Last commit date
billing-form-fields.php 1 year ago billing.php 1 year ago cart.php 10 months ago checkout-details.php 2 months ago checkout.php 8 months ago order-placement-failed.php 8 months ago order-placement-success.php 8 months ago
checkout.php
223 lines
1 <?php
2 /**
3 * Checkout Template.
4 *
5 * @package Tutor\Views
6 * @author Themeum <support@themeum.com>
7 * @link https://themeum.com
8 * @since 3.0.0
9 */
10
11 if ( ! defined( 'ABSPATH' ) ) {
12 exit;
13 }
14
15 use Tutor\Ecommerce\CheckoutController;
16 use Tutor\Ecommerce\CartController;
17 use TUTOR\Input;
18
19 $user_id = apply_filters( 'tutor_checkout_user_id', get_current_user_id() );
20
21 $tutor_toc_page_link = tutor_utils()->get_toc_page_link();
22 $tutor_privacy_page_link = tutor_utils()->get_privacy_page_link();
23
24 $cart_controller = new CartController();
25 $get_cart = $cart_controller->get_cart_items();
26 $courses = $get_cart['courses'];
27 $total_count = $courses['total_count'];
28 $course_list = $courses['results'];
29 $subtotal = 0;
30 $course_ids = implode( ', ', array_values( array_column( $course_list, 'ID' ) ) );
31 $plan_id = Input::get( 'plan', 0, Input::TYPE_INT );
32
33 $is_checkout_page = true;
34
35 ?>
36 <div class="tutor-checkout-page">
37 <div class="tutor-container">
38 <div class="tutor-checkout-container">
39 <?php
40 $echo_before_return = true;
41 $user_has_subscription = apply_filters( 'tutor_checkout_user_has_subscription', false, $plan_id, $echo_before_return );
42 if ( $user_has_subscription ) {
43 return;
44 }
45 ?>
46
47 <!-- Alert if nonce failed -->
48 <?php
49 $nonce_alert = get_transient( CheckoutController::PAY_NOW_ALERT_MSG_TRANSIENT_KEY . 'pay_now_nonce_alert' );
50 if ( $nonce_alert ) {
51 ?>
52 <div class="tutor-alert tutor-danger">
53 <div class="tutor-color-danger"><?php echo esc_html( $nonce_alert[0] ); ?></div>
54 </div>
55 <?php
56 delete_transient( CheckoutController::PAY_NOW_ALERT_MSG_TRANSIENT_KEY . 'pay_now_nonce_alert' );
57 }
58 ?>
59
60 <form method="post" id="tutor-checkout-form">
61 <?php tutor_nonce_field(); ?>
62 <input type="hidden" name="tutor_action" value="tutor_pay_now">
63 <div class="tutor-row tutor-g-5">
64 <div class="tutor-col-md-6" tutor-checkout-details>
65 <?php
66 $file = __DIR__ . '/checkout-details.php';
67 if ( file_exists( $file ) ) {
68 include $file;
69 }
70 ?>
71 </div>
72 <div class="tutor-col-md-6">
73 <div class="tutor-checkout-billing">
74 <div class="tutor-checkout-billing-inner">
75 <?php
76 if ( ! is_user_logged_in() ) {
77 $login_url = tutor_utils()->get_option( 'enable_tutor_native_login', null ) ? '' : wp_login_url( tutor()->current_url );
78 ?>
79 <div class="tutor-mb-32 tutor-d-flex tutor-align-center tutor-justify-between tutor-border tutor-radius-6 tutor-p-12">
80 <p class="tutor-m-0"><?php esc_html_e( 'Already have an account?', 'tutor' ); ?></p>
81 <button type="button" class="tutor-btn tutor-btn-secondary tutor-btn-sm tutor-open-login-modal" data-login_url="<?php echo esc_url( $login_url ); ?>">
82 <?php esc_html_e( 'Login', 'tutor' ); ?>
83 </button>
84 </div>
85 <?php } ?>
86
87 <h5 class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-12 tutor-mt-0">
88 <?php
89 $address_title = __( 'Billing Address', 'tutor' );
90 if ( ! is_user_logged_in() ) {
91 $address_title = __( 'Continue as Guest', 'tutor' );
92 }
93
94 echo esc_html( $address_title );
95 ?>
96 </h5>
97
98 <div class="tutor-billing-fields">
99 <?php require tutor()->path . 'templates/ecommerce/billing-form-fields.php'; ?>
100 </div>
101 <div class="tutor-payment-method-wrapper tutor-mt-20 <?php echo esc_attr( $show_payment_methods ? '' : 'tutor-d-none' ); ?>">
102 <h5 class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-12">
103 <?php esc_html_e( 'Payment Method', 'tutor' ); ?>
104 </h5>
105 <div class="tutor-checkout-payment-options tutor-mb-24">
106 <input type="hidden" name="payment_type">
107
108 <?php if ( ! $show_payment_methods ) : ?>
109 <input type="hidden" name="payment_method" value="free" id="tutor-temp-payment-method">
110 <?php endif; ?>
111
112 <?php
113 $supported_gateways = $plan_id ? tutor_get_subscription_supported_payment_gateways() : tutor_get_all_active_payment_gateways();
114 if ( empty( $supported_gateways ) ) {
115 ?>
116
117 <div class="tutor-alert tutor-warning">
118 <?php esc_html_e( 'No payment method found. Please contact the site administrator.', 'tutor' ); ?>
119 </div>
120 <?php
121 } else {
122 foreach ( $supported_gateways as $gateway ) {
123 list( 'name' => $name, 'label' => $label, 'icon' => $icon ) = $gateway;
124 $is_manual = $gateway['is_manual'] ?? false;
125 if ( $is_manual ) {
126 ?>
127 <label class="tutor-checkout-payment-item" data-payment-method="<?php echo esc_attr( $name ); ?>" data-payment-type="manual">
128 <input type="radio" value="<?php echo esc_attr( $name ); ?>" name="payment_method" class="tutor-form-check-input">
129 <div class="tutor-payment-item-content">
130 <?php if ( ! empty( $icon ) ) : ?>
131 <img src ="<?php echo esc_url( $icon ); ?>" alt="<?php echo esc_attr( $name ); ?>"/>
132 <?php endif; ?>
133 <?php echo esc_html( $label ); ?>
134 </div>
135 <div class="tutor-d-none tutor-payment-item-instructions"><?php echo wp_kses_post( $gateway['payment_instructions'] ?? '' ); ?></div>
136 </label>
137 <?php
138 } else {
139 ?>
140 <label class="tutor-checkout-payment-item" data-payment-type="automate">
141 <input type="radio" name="payment_method" value="<?php echo esc_attr( $name ); ?>" class="tutor-form-check-input">
142 <div class="tutor-payment-item-content">
143 <?php if ( ! empty( $icon ) ) : ?>
144 <img src = "<?php echo esc_url( $icon ); ?>" alt="<?php echo esc_attr( $name ); ?>"/>
145 <?php endif; ?>
146 <?php echo esc_html( $label ); ?>
147 </div>
148 </label>
149 <?php
150 }
151 }
152 }
153 ?>
154 </div>
155
156 <div class="tutor-payment-instructions tutor-mb-20 tutor-d-none"></div>
157 </div>
158 <?php if ( null !== $tutor_toc_page_link ) : ?>
159 <div class="tutor-mt-20">
160 <div class="tutor-form-check tutor-d-flex">
161 <input type="checkbox" id="tutor_checkout_agree_to_terms" name="agree_to_terms" class="tutor-form-check-input" required>
162 <label for="tutor_checkout_agree_to_terms">
163 <span class="tutor-color-subdued tutor-fw-normal">
164 <?php esc_html_e( 'I agree with the website\'s', 'tutor' ); ?>
165 <a target="_blank" href="<?php echo esc_url( $tutor_toc_page_link ); ?>" class="tutor-color-primary"><?php esc_html_e( 'Terms of Use', 'tutor' ); ?></a>
166 <?php if ( null !== $tutor_privacy_page_link ) : ?>
167 <?php esc_html_e( 'and', 'tutor' ); ?>
168 <a target="_blank" href="<?php echo esc_url( $tutor_privacy_page_link ); ?>" class="tutor-color-primary"><?php esc_html_e( 'Privacy Policy', 'tutor' ); ?></a>
169 <?php endif; ?>
170 </span>
171 </label>
172 </div>
173 </div>
174 <?php endif; ?>
175 <!-- handle errors -->
176 <?php
177 $pay_now_errors = get_transient( CheckoutController::PAY_NOW_ERROR_TRANSIENT_KEY . $user_id );
178 $pay_now_alert_msg = get_transient( CheckoutController::PAY_NOW_ALERT_MSG_TRANSIENT_KEY . $user_id );
179
180 delete_transient( CheckoutController::PAY_NOW_ALERT_MSG_TRANSIENT_KEY . $user_id );
181 delete_transient( CheckoutController::PAY_NOW_ERROR_TRANSIENT_KEY . $user_id );
182 if ( $pay_now_errors || $pay_now_alert_msg ) :
183 ?>
184 <div class="tutor-break-word tutor-mt-16">
185 <?php
186 if ( ! empty( $pay_now_alert_msg ) ) :
187 list( $alert, $message ) = array_values( $pay_now_alert_msg );
188 ?>
189 <div class="tutor-alert tutor-<?php echo esc_attr( $alert ); ?>">
190 <div class="tutor-color-<?php echo esc_attr( $alert ); ?>"><?php echo esc_html( $message ); ?></div>
191 </div>
192 <?php endif; ?>
193
194 <?php if ( is_array( $pay_now_errors ) && count( $pay_now_errors ) ) : ?>
195 <div class="tutor-alert tutor-danger">
196 <ul class="tutor-mb-0">
197 <?php foreach ( $pay_now_errors as $pay_now_err ) : ?>
198 <li class="tutor-color-danger"><?php echo esc_html( ucfirst( str_replace( '_', ' ', $pay_now_err ) ) ); ?></li>
199 <?php endforeach; ?>
200 </ul>
201 </div>
202 <?php endif; ?>
203 </div>
204 <?php endif; ?>
205 <!-- handle errors end -->
206 <?php $enable_pay_now_btn = apply_filters( 'tutor_checkout_enable_pay_now_btn', true, $checkout_data ); ?>
207 <button type="submit" <?php echo $enable_pay_now_btn ? '' : 'disabled'; ?> id="tutor-checkout-pay-now-button" class="tutor-btn tutor-btn-primary tutor-btn-lg tutor-w-100 tutor-justify-center tutor-mt-16">
208 <?php echo esc_html( $pay_now_btn_text ); ?>
209 </button>
210 </div>
211 </div>
212 </div>
213 </div>
214 </form>
215 </div>
216 </div>
217 </div>
218 <?php
219 if ( ! is_user_logged_in() ) {
220 tutor_load_template_from_custom_path( tutor()->path . '/views/modal/login.php' );
221 }
222 ?>
223