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.2 3.5.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 11 months ago checkout-details.php 11 months ago checkout.php 11 months ago order-placement-failed.php 1 year ago order-placement-success.php 1 year ago
cart.php
177 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 <?php if ( tutor()->has_pro && 'course-bundle' === $course->post_type ) : ?>
71 <div class="tutor-cart-course-bundle-badge">
72 <?php
73 $bundle_model = new \TutorPro\CourseBundle\Models\BundleModel();
74 $bundle_course_ids = $bundle_model::get_bundle_course_ids( $course->ID );
75 // translators: %d: Number of courses in the cart.
76 echo esc_html( sprintf( __( '%d Course bundle', 'tutor' ), count( $bundle_course_ids ) ) );
77 ?>
78 </div>
79 <?php endif; ?>
80 <h5 class="tutor-fs-6 tutor-fw-medium tutor-color-black">
81 <a href="<?php echo esc_url( get_the_permalink( $course ) ); ?>">
82 <?php echo esc_html( $course->post_title ); ?>
83 </a>
84 </h5>
85 <ul class="tutor-cart-course-info">
86 <?php if ( $course_duration ) : ?>
87 <li><?php echo esc_html( tutor_utils()->clean_html_content( $course_duration ) ); ?> <span></span></li>
88 <?php endif; ?>
89 <li><?php echo esc_html( get_tutor_course_level( $course->ID ) ); ?></li>
90 </ul>
91 </div>
92 <div class="tutor-cart-course-price-wrapper">
93 <div class="tutor-cart-course-price">
94 <div class="tutor-fw-bold">
95 <?php tutor_print_formatted_price( $display_price ); ?>
96 </div>
97 <?php if ( $regular_price && $sale_price && $sale_price !== $regular_price ) : ?>
98 <div class="tutor-cart-discount-price">
99 <?php tutor_print_formatted_price( $regular_price ); ?>
100 </div>
101 <?php endif; ?>
102 </div>
103 <button class="tutor-btn tutor-btn-link tutor-cart-remove-button" data-course-id="<?php echo esc_attr( $course->ID ); ?>">
104 <?php esc_html_e( 'Remove', 'tutor' ); ?>
105 </button>
106 </div>
107 </div>
108 <?php endforeach; ?>
109 </div>
110 </div>
111 <?php
112 $should_calculate_tax = Tax::should_calculate_tax();
113 $is_tax_included_in_price = Tax::is_tax_included_in_price();
114 $tax_rate = Tax::get_user_tax_rate();
115 $show_tax_incl_text = $should_calculate_tax && $tax_rate > 0 && $is_tax_included_in_price;
116 $tax_amount = 0;
117
118 if ( $should_calculate_tax ) {
119 $tax_amount = Tax::calculate_tax( $subtotal, $tax_rate );
120 $tax_exempt_amount = Tax::calculate_tax( $tax_exempt_price, $tax_rate );
121 $tax_amount = $tax_amount - $tax_exempt_amount;
122 }
123
124 $grand_total = $subtotal;
125 if ( ! $is_tax_included_in_price ) {
126 $grand_total += $tax_amount;
127 }
128 ?>
129 <div class="tutor-col-lg-4">
130 <h3 class="tutor-fs-3 tutor-fw-bold tutor-color-black tutor-mb-16"><div><?php esc_html_e( 'Summary:', 'tutor' ); ?></div></h3>
131 <div class="tutor-cart-summery">
132 <div class="tutor-cart-summery-top">
133 <div class="tutor-cart-summery-item tutor-fw-medium">
134 <div><?php esc_html_e( 'Subtotal:', 'tutor' ); ?></div>
135 <div><?php tutor_print_formatted_price( $subtotal ); ?></div>
136 </div>
137 <?php if ( $should_calculate_tax && $tax_rate > 0 && ! $is_tax_included_in_price ) : ?>
138 <div class="tutor-cart-summery-item">
139 <div><?php esc_html_e( 'Tax:', 'tutor' ); ?></div>
140 <div><?php tutor_print_formatted_price( $tax_amount ); ?></div>
141 </div>
142 <?php endif; ?>
143 </div>
144 <div class="tutor-cart-summery-bottom">
145 <div class="tutor-cart-summery-item tutor-fw-medium <?php echo esc_attr( $show_tax_incl_text ? '' : 'tutor-mb-40' ); ?>">
146 <div><?php esc_html_e( 'Grand total', 'tutor' ); ?></div>
147 <div><?php tutor_print_formatted_price( $grand_total ); ?></div>
148 </div>
149 <?php
150 if ( $should_calculate_tax && $tax_rate > 0 && $is_tax_included_in_price ) :
151 ?>
152 <div class="tutor-text-right tutor-fs-7 tutor-color-muted tutor-mb-40">
153 <?php
154 /* translators: %s: tax amount */
155 echo esc_html( sprintf( __( '(Incl. Tax %s)', 'tutor' ), tutor_get_formatted_price( $tax_amount ) ) );
156 ?>
157 </div>
158 <?php endif ?>
159
160 <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 : '#' ); ?>">
161 <?php esc_html_e( 'Proceed to checkout', 'tutor' ); ?>
162 </a>
163 </div>
164 </div>
165 </div>
166 </div>
167 <?php else : ?>
168 <div class="tutor-cart-empty-state">
169 <img src="<?php echo esc_url( tutor()->url ); ?>assets/images/empty-cart.svg" alt="<?php esc_html_e( 'Empty shopping cart', 'tutor' ); ?>" />
170 <p><?php esc_html_e( 'No courses in the cart', 'tutor' ); ?></p>
171 <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>
172 </div>
173 <?php endif; ?>
174 </div>
175 </div>
176 </div>
177