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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 1 year ago checkout-details.php 1 year ago checkout.php 1 year ago order-placement-failed.php 1 year ago order-placement-success.php 1 year ago
checkout.php
209 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 <form method="post" id="tutor-checkout-form">
48 <?php tutor_nonce_field(); ?>
49 <input type="hidden" name="tutor_action" value="tutor_pay_now">
50 <div class="tutor-row tutor-g-5">
51 <div class="tutor-col-md-6" tutor-checkout-details>
52 <?php
53 $file = __DIR__ . '/checkout-details.php';
54 if ( file_exists( $file ) ) {
55 include $file;
56 }
57 ?>
58 </div>
59 <div class="tutor-col-md-6">
60 <div class="tutor-checkout-billing">
61 <div class="tutor-checkout-billing-inner">
62 <?php
63 if ( ! is_user_logged_in() ) {
64 $login_url = tutor_utils()->get_option( 'enable_tutor_native_login', null ) ? '' : wp_login_url( tutor()->current_url );
65 ?>
66 <div class="tutor-mb-32 tutor-d-flex tutor-align-center tutor-justify-between tutor-border tutor-radius-6 tutor-p-12">
67 <p class="tutor-mb-0"><?php esc_html_e( 'Already have an account?', 'tutor' ); ?></p>
68 <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 ); ?>">
69 <?php esc_html_e( 'Login', 'tutor' ); ?>
70 </button>
71 </div>
72 <?php } ?>
73
74 <h5 class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-12">
75 <?php
76 $address_title = __( 'Billing Address', 'tutor' );
77 if ( ! is_user_logged_in() ) {
78 $address_title = __( 'Continue as Guest', 'tutor' );
79 }
80
81 echo esc_html( $address_title );
82 ?>
83 </h5>
84
85 <div class="tutor-billing-fields">
86 <?php require tutor()->path . 'templates/ecommerce/billing-form-fields.php'; ?>
87 </div>
88 <div class="tutor-payment-method-wrapper tutor-mt-20">
89 <?php if ( ! $is_zero_price ) : ?>
90 <h5 class="tutor-fs-5 tutor-fw-medium tutor-color-black tutor-mb-12">
91 <?php esc_html_e( 'Payment Method', 'tutor' ); ?>
92 </h5>
93 <div class="tutor-checkout-payment-options tutor-mb-24">
94 <input type="hidden" name="payment_type">
95 <?php
96 $supported_gateways = $plan_id ? tutor_get_subscription_supported_payment_gateways() : tutor_get_all_active_payment_gateways();
97 if ( empty( $supported_gateways ) ) {
98 ?>
99
100 <div class="tutor-alert tutor-warning">
101 <?php esc_html_e( 'No payment method found. Please contact the site administrator.', 'tutor' ); ?>
102 </div>
103 <?php
104 } else {
105 foreach ( $supported_gateways as $gateway ) {
106 list( 'name' => $name, 'label' => $label, 'icon' => $icon ) = $gateway;
107 $is_manual = $gateway['is_manual'] ?? false;
108 if ( $is_manual ) {
109 ?>
110 <label class="tutor-checkout-payment-item" data-payment-method="<?php echo esc_attr( $name ); ?>" data-payment-type="manual" data-payment-details="<?php echo esc_attr( $gateway['additional_details'] ?? '' ); ?>" data-payment-instruction="<?php echo esc_attr( $gateway['payment_instructions'] ?? '' ); ?>">
111 <input type="radio" value="<?php echo esc_attr( $name ); ?>" name="payment_method" class="tutor-form-check-input" required>
112 <div class="tutor-payment-item-content">
113 <?php if ( ! empty( $icon ) ) : ?>
114 <img src ="<?php echo esc_url( $icon ); ?>" alt="<?php echo esc_attr( $name ); ?>"/>
115 <?php endif; ?>
116 <?php echo esc_html( $label ); ?>
117 </div>
118 </label>
119 <?php
120 } else {
121 ?>
122 <label class="tutor-checkout-payment-item" data-payment-type="automate">
123 <input type="radio" name="payment_method" value="<?php echo esc_attr( $name ); ?>" class="tutor-form-check-input" required>
124 <div class="tutor-payment-item-content">
125 <?php if ( ! empty( $icon ) ) : ?>
126 <img src = "<?php echo esc_url( $icon ); ?>" alt="<?php echo esc_attr( $name ); ?>"/>
127 <?php endif; ?>
128 <?php echo esc_html( $label ); ?>
129 </div>
130 </label>
131 <?php
132 }
133 }
134 }
135 ?>
136 </div>
137
138 <div class="tutor-payment-instructions tutor-mb-20 tutor-d-none"></div>
139 <?php else : ?>
140 <input type="hidden" name="payment_method" value="free">
141 <input type="hidden" name="payment_type" value="manual">
142 <?php endif; ?>
143 </div>
144 <?php if ( null !== $tutor_toc_page_link ) : ?>
145 <div class="tutor-mb-16 <?php echo esc_attr( $is_zero_price ? 'tutor-mt-20' : '' ); ?>">
146 <div class="tutor-form-check tutor-d-flex">
147 <input type="checkbox" id="tutor_checkout_agree_to_terms" name="agree_to_terms" class="tutor-form-check-input" required>
148 <label for="tutor_checkout_agree_to_terms">
149 <span class="tutor-color-subdued tutor-fw-normal">
150 <?php esc_html_e( 'I agree with the website\'s', 'tutor' ); ?>
151 <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>
152 <?php if ( null !== $tutor_privacy_page_link ) : ?>
153 <?php esc_html_e( 'and', 'tutor' ); ?>
154 <a target="_blank" href="<?php echo esc_url( $tutor_privacy_page_link ); ?>" class="tutor-color-primary"><?php esc_html_e( 'Privacy Policy', 'tutor' ); ?></a>
155 <?php endif; ?>
156 </span>
157 </label>
158 </div>
159 </div>
160 <?php endif; ?>
161 <!-- handle errors -->
162 <?php
163 $pay_now_errors = get_transient( CheckoutController::PAY_NOW_ERROR_TRANSIENT_KEY . $user_id );
164 $pay_now_alert_msg = get_transient( CheckoutController::PAY_NOW_ALERT_MSG_TRANSIENT_KEY . $user_id );
165
166 delete_transient( CheckoutController::PAY_NOW_ALERT_MSG_TRANSIENT_KEY . $user_id );
167 delete_transient( CheckoutController::PAY_NOW_ERROR_TRANSIENT_KEY . $user_id );
168 if ( $pay_now_errors || $pay_now_alert_msg ) :
169 ?>
170 <div class="tutor-break-word">
171 <?php
172 if ( ! empty( $pay_now_alert_msg ) ) :
173 list( $alert, $message ) = array_values( $pay_now_alert_msg );
174 ?>
175 <div class="tutor-alert tutor-<?php echo esc_attr( $alert ); ?>">
176 <div class="tutor-color-<?php echo esc_attr( $alert ); ?>"><?php echo esc_html( $message ); ?></div>
177 </div>
178 <?php endif; ?>
179
180 <?php if ( is_array( $pay_now_errors ) && count( $pay_now_errors ) ) : ?>
181 <div class="tutor-alert tutor-danger">
182 <ul class="tutor-mb-0">
183 <?php foreach ( $pay_now_errors as $pay_now_err ) : ?>
184 <li class="tutor-color-danger"><?php echo esc_html( ucfirst( str_replace( '_', ' ', $pay_now_err ) ) ); ?></li>
185 <?php endforeach; ?>
186 </ul>
187 </div>
188 <?php endif; ?>
189 </div>
190 <?php endif; ?>
191 <!-- handle errors end -->
192 <?php $enable_pay_now_btn = apply_filters( 'tutor_checkout_enable_pay_now_btn', true, $checkout_data ); ?>
193 <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">
194 <?php echo esc_html( $pay_now_btn_text ); ?>
195 </button>
196 </div>
197 </div>
198 </div>
199 </div>
200 </form>
201 </div>
202 </div>
203 </div>
204 <?php
205 if ( ! is_user_logged_in() ) {
206 tutor_load_template_from_custom_path( tutor()->path . '/views/modal/login.php' );
207 }
208 ?>
209