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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 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
cart.php
162 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
20 $cart_controller = new CartController();
21 $get_cart = $cart_controller->get_cart_items();
22 $courses = $get_cart['courses'];
23 $total_count = $courses['total_count'];
24 $course_list = $courses['results'];
25 $subtotal = 0;
26
27 $checkout_page_url = CheckoutController::get_page_url();
28
29 ?>
30 <div class="tutor-cart-page">
31 <div class="tutor-cart-page-wrapper">
32 <div class="tutor-container">
33 <?php if ( is_array( $course_list ) && count( $course_list ) ) : ?>
34 <div class="tutor-row tutor-g-4">
35 <div class="tutor-col-lg-8">
36 <h3 class="tutor-fs-3 tutor-fw-bold tutor-color-black tutor-mb-16">
37 <?php
38 // translators: %d: Number of courses in the cart.
39 echo esc_html( sprintf( _n( '%d Course in Cart', '%d Courses in Cart', $total_count, 'tutor' ), $total_count ) );
40 ?>
41 </h3>
42
43 <div class="tutor-cart-course-list">
44 <?php
45 foreach ( $course_list as $key => $course ) :
46 $course_duration = get_tutor_course_duration_context( $course->ID, true );
47 $course_price = tutor_utils()->get_raw_course_price( $course->ID );
48 $regular_price = $course_price->regular_price;
49 $sale_price = $course_price->sale_price;
50 $tutor_course_img = get_tutor_course_thumbnail_src( '', $course->ID );
51
52 $subtotal += $sale_price ? $sale_price : $regular_price;
53 ?>
54 <div class="tutor-cart-course-item">
55 <div class="tutor-cart-course-thumb">
56 <a href="<?php echo esc_url( get_the_permalink( $course ) ); ?>">
57 <img src="<?php echo esc_url( $tutor_course_img ); ?>" alt="Course thumb">
58 </a>
59 </div>
60 <div class="tutor-cart-course-title">
61 <?php if ( tutor()->has_pro && 'course-bundle' === $course->post_type ) : ?>
62 <div class="tutor-cart-course-bundle-badge">
63 <?php
64 $bundle_model = new \TutorPro\CourseBundle\Models\BundleModel();
65 $bundle_course_ids = $bundle_model::get_bundle_course_ids( $course->ID );
66 // translators: %d: Number of courses in the cart.
67 echo esc_html( sprintf( __( '%d Course bundle', 'tutor' ), count( $bundle_course_ids ) ) );
68 ?>
69 </div>
70 <?php endif; ?>
71 <h5 class="tutor-fs-6 tutor-fw-medium tutor-color-black">
72 <a href="<?php echo esc_url( get_the_permalink( $course ) ); ?>">
73 <?php echo esc_html( $course->post_title ); ?>
74 </a>
75 </h5>
76 <ul class="tutor-cart-course-info">
77 <?php if ( $course_duration ) : ?>
78 <li><?php echo esc_html( tutor_utils()->clean_html_content( $course_duration ) ); ?> <span></span></li>
79 <?php endif; ?>
80 <li><?php echo esc_html( get_tutor_course_level( $course->ID ) ); ?></li>
81 </ul>
82 </div>
83 <div class="tutor-cart-course-price-wrapper">
84 <div class="tutor-cart-course-price">
85 <div class="tutor-fw-bold">
86 <?php echo tutor_get_formatted_price( $sale_price ? $sale_price : $regular_price ); //phpcs:ignore?>
87 </div>
88 <?php if ( $regular_price && $sale_price && $sale_price !== $regular_price ) : ?>
89 <div class="tutor-cart-discount-price">
90 <?php echo tutor_get_formatted_price( $regular_price ); //phpcs:ignore?>
91 </div>
92 <?php endif; ?>
93 </div>
94 <button class="tutor-btn tutor-btn-link tutor-cart-remove-button" data-course-id="<?php echo esc_attr( $course->ID ); ?>">
95 <?php esc_html_e( 'Remove', 'tutor' ); ?>
96 </button>
97 </div>
98 </div>
99 <?php endforeach; ?>
100 </div>
101 </div>
102 <?php
103 $is_tax_configured = Tax::is_tax_configured();
104 $is_tax_included_in_price = Tax::is_tax_included_in_price();
105 $tax_rate = Tax::get_user_tax_rate();
106 $tax_amount = Tax::calculate_tax( $subtotal, $tax_rate );
107 $grand_total = $subtotal;
108 $show_tax_incl_text = $is_tax_configured && $tax_rate > 0 && $is_tax_included_in_price;
109
110 if ( ! $is_tax_included_in_price ) {
111 $grand_total += $tax_amount;
112 }
113 ?>
114 <div class="tutor-col-lg-4">
115 <h3 class="tutor-fs-3 tutor-fw-bold tutor-color-black tutor-mb-16"><div><?php esc_html_e( 'Summary:', 'tutor' ); ?></div></h3>
116 <div class="tutor-cart-summery">
117 <div class="tutor-cart-summery-top">
118 <div class="tutor-cart-summery-item tutor-fw-medium">
119 <div><?php esc_html_e( 'Subtotal:', 'tutor' ); ?></div>
120 <div><?php tutor_print_formatted_price( $subtotal ); ?></div>
121 </div>
122 <?php if ( $is_tax_configured && $tax_rate > 0 && ! $is_tax_included_in_price ) : ?>
123 <div class="tutor-cart-summery-item">
124 <div><?php esc_html_e( 'Tax:', 'tutor' ); ?></div>
125 <div><?php tutor_print_formatted_price( $tax_amount ); ?></div>
126 </div>
127 <?php endif; ?>
128 </div>
129 <div class="tutor-cart-summery-bottom">
130 <div class="tutor-cart-summery-item tutor-fw-medium <?php echo esc_attr( $show_tax_incl_text ? '' : 'tutor-mb-40' ); ?>">
131 <div><?php esc_html_e( 'Grand total', 'tutor' ); ?></div>
132 <div><?php tutor_print_formatted_price( $grand_total ); ?></div>
133 </div>
134 <?php
135 if ( $is_tax_configured && $tax_rate > 0 && $is_tax_included_in_price ) :
136 ?>
137 <div class="tutor-text-right tutor-fs-7 tutor-color-muted tutor-mb-40">
138 <?php
139 /* translators: %s: tax amount */
140 echo esc_html( sprintf( __( '(Incl. Tax %s)', 'tutor' ), tutor_get_formatted_price( $tax_amount ) ) );
141 ?>
142 </div>
143 <?php endif ?>
144
145 <a 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 : '#' ); ?>">
146 <?php esc_html_e( 'Proceed to checkout', 'tutor' ); ?>
147 </a>
148 </div>
149 </div>
150 </div>
151 </div>
152 <?php else : ?>
153 <div class="tutor-cart-empty-state">
154 <img src="<?php echo esc_url( tutor()->url ); ?>assets/images/empty-cart.svg" alt="<?php esc_html_e( 'Empty shopping cart', 'tutor' ); ?>" />
155 <p><?php esc_html_e( 'No courses in the cart', 'tutor' ); ?></p>
156 <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>
157 </div>
158 <?php endif; ?>
159 </div>
160 </div>
161 </div>
162