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