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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 / cart.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 7 months ago checkout.php 8 months ago order-placement-failed.php 8 months ago order-placement-success.php 8 months ago
cart.php
170 lines
1 <?php
2 /**
3 * Cart Template
4 * For tutor monetization.
5 *
6 * @package Tutor\Views
7 * @author Themeum <support@themeum.com>
8 * @link https://themeum.com
9 * @since 3.0.0
10 */
11
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15
16 use Tutor\Ecommerce\CartController;
17 use Tutor\Ecommerce\CheckoutController;
18 use Tutor\Ecommerce\Tax;
19 use Tutor\Models\CourseModel;
20
21 $cart_controller = new CartController();
22 $get_cart = $cart_controller->get_cart_items();
23 $courses = $get_cart['courses'];
24 $total_count = $courses['total_count'];
25 $course_list = $courses['results'];
26
27 $subtotal = 0;
28 $tax_exempt_price = 0;
29
30 $checkout_page_url = CheckoutController::get_page_url();
31
32 ?>
33 <div class="tutor-cart-page">
34 <div class="tutor-cart-page-wrapper">
35 <div class="tutor-container">
36 <?php if ( is_array( $course_list ) && count( $course_list ) ) : ?>
37 <div class="tutor-row tutor-g-4">
38 <div class="tutor-col-lg-8">
39 <h3 class="tutor-fs-3 tutor-fw-bold tutor-color-black tutor-mb-16">
40 <?php
41 // translators: %d: Number of courses in the cart.
42 echo esc_html( sprintf( _n( '%d Course in Cart', '%d Courses in Cart', $total_count, 'tutor' ), $total_count ) );
43 ?>
44 </h3>
45
46 <div class="tutor-cart-course-list">
47 <?php
48 foreach ( $course_list as $key => $course ) :
49 $course_duration = get_tutor_course_duration_context( $course->ID, true );
50 $course_price = tutor_utils()->get_raw_course_price( $course->ID );
51 $regular_price = $course_price->regular_price;
52 $sale_price = $course_price->sale_price;
53 $display_price = $sale_price ? $sale_price : $regular_price;
54 $tutor_course_img = get_tutor_course_thumbnail_src( '', $course->ID );
55
56 $subtotal += $display_price;
57
58 $tax_collection = CourseModel::is_tax_enabled_for_single_purchase( $course->ID );
59 if ( ! $tax_collection ) {
60 $tax_exempt_price += $display_price;
61 }
62 ?>
63 <div class="tutor-cart-course-item">
64 <div class="tutor-cart-course-thumb">
65 <a href="<?php echo esc_url( get_the_permalink( $course ) ); ?>">
66 <img src="<?php echo esc_url( $tutor_course_img ); ?>" alt="Course thumb">
67 </a>
68 </div>
69 <div class="tutor-cart-course-title">
70 <div class="tutor-d-flex tutor-align-center tutor-gap-4px">
71 <?php do_action( 'tutor_cart_item_badge', $course ); ?>
72 </div>
73 <h5 class="tutor-fs-6 tutor-fw-medium tutor-color-black">
74 <a href="<?php echo esc_url( get_the_permalink( $course ) ); ?>">
75 <?php echo esc_html( $course->post_title ); ?>
76 </a>
77 </h5>
78 <ul class="tutor-cart-course-info">
79 <?php if ( $course_duration ) : ?>
80 <li><?php echo esc_html( tutor_utils()->clean_html_content( $course_duration ) ); ?> <span></span></li>
81 <?php endif; ?>
82 <li><?php echo esc_html( get_tutor_course_level( $course->ID ) ); ?></li>
83 </ul>
84 </div>
85 <div class="tutor-cart-course-price-wrapper">
86 <div class="tutor-cart-course-price">
87 <div class="tutor-fw-bold">
88 <?php tutor_print_formatted_price( $display_price ); ?>
89 </div>
90 <?php if ( $regular_price && $sale_price && $sale_price !== $regular_price ) : ?>
91 <div class="tutor-cart-discount-price">
92 <?php tutor_print_formatted_price( $regular_price ); ?>
93 </div>
94 <?php endif; ?>
95 </div>
96 <button class="tutor-btn tutor-btn-link tutor-cart-remove-button" data-course-id="<?php echo esc_attr( $course->ID ); ?>">
97 <?php esc_html_e( 'Remove', 'tutor' ); ?>
98 </button>
99 </div>
100 </div>
101 <?php endforeach; ?>
102 </div>
103 </div>
104 <?php
105 $should_calculate_tax = Tax::should_calculate_tax();
106 $is_tax_included_in_price = Tax::is_tax_included_in_price();
107 $tax_rate = Tax::get_user_tax_rate();
108 $show_tax_incl_text = $should_calculate_tax && $tax_rate > 0 && $is_tax_included_in_price;
109 $tax_amount = 0;
110
111 if ( $should_calculate_tax ) {
112 $tax_amount = Tax::calculate_tax( $subtotal, $tax_rate );
113 $tax_exempt_amount = Tax::calculate_tax( $tax_exempt_price, $tax_rate );
114 $tax_amount = $tax_amount - $tax_exempt_amount;
115 }
116
117 $grand_total = $subtotal;
118 if ( ! $is_tax_included_in_price ) {
119 $grand_total += $tax_amount;
120 }
121 ?>
122 <div class="tutor-col-lg-4">
123 <h3 class="tutor-fs-3 tutor-fw-bold tutor-color-black tutor-mb-16"><div><?php esc_html_e( 'Summary:', 'tutor' ); ?></div></h3>
124 <div class="tutor-cart-summery">
125 <div class="tutor-cart-summery-top">
126 <div class="tutor-cart-summery-item tutor-fw-medium">
127 <div><?php esc_html_e( 'Subtotal:', 'tutor' ); ?></div>
128 <div><?php tutor_print_formatted_price( $subtotal ); ?></div>
129 </div>
130 <?php if ( $should_calculate_tax && $tax_rate > 0 && ! $is_tax_included_in_price ) : ?>
131 <div class="tutor-cart-summery-item">
132 <div><?php esc_html_e( 'Tax:', 'tutor' ); ?></div>
133 <div><?php tutor_print_formatted_price( $tax_amount ); ?></div>
134 </div>
135 <?php endif; ?>
136 </div>
137 <div class="tutor-cart-summery-bottom">
138 <div class="tutor-cart-summery-item tutor-fw-medium <?php echo esc_attr( $show_tax_incl_text ? '' : 'tutor-mb-40' ); ?>">
139 <div><?php esc_html_e( 'Grand total', 'tutor' ); ?></div>
140 <div><?php tutor_print_formatted_price( $grand_total ); ?></div>
141 </div>
142 <?php
143 if ( $should_calculate_tax && $tax_rate > 0 && $is_tax_included_in_price ) :
144 ?>
145 <div class="tutor-text-right tutor-fs-7 tutor-color-muted tutor-mb-40">
146 <?php
147 /* translators: %s: tax amount */
148 echo esc_html( sprintf( __( '(Incl. Tax %s)', 'tutor' ), tutor_get_formatted_price( $tax_amount ) ) );
149 ?>
150 </div>
151 <?php endif ?>
152
153 <a data-cy="tutor-native-checkout-button" class="tutor-btn tutor-btn-primary tutor-btn-lg tutor-w-100 tutor-justify-center <?php echo esc_attr( $checkout_page_url ? '' : 'tutor-checkout-page-not-configured' ); ?>" href="<?php echo esc_url( $checkout_page_url ? $checkout_page_url : '#' ); ?>">
154 <?php esc_html_e( 'Proceed to checkout', 'tutor' ); ?>
155 </a>
156 </div>
157 </div>
158 </div>
159 </div>
160 <?php else : ?>
161 <div class="tutor-cart-empty-state">
162 <img src="<?php echo esc_url( tutor()->url ); ?>assets/images/empty-cart.svg" alt="<?php esc_html_e( 'Empty shopping cart', 'tutor' ); ?>" />
163 <p><?php esc_html_e( 'No courses in the cart', 'tutor' ); ?></p>
164 <a href="<?php echo esc_url( tutor_utils()->course_archive_page_url() ); ?>" class="tutor-btn tutor-btn-lg tutor-btn-primary"><?php esc_html_e( 'Continue Browsing', 'tutor' ); ?></a>
165 </div>
166 <?php endif; ?>
167 </div>
168 </div>
169 </div>
170