<?php /** * A single course loop add to cart * * @since v.1.0.0 * @author themeum * @url https://themeum.com * * @package TutorLMS/Templates * @version 1.4.3 */ if ( ! defined( 'ABSPATH' ) ) { exit; } $product_id = tutor_utils()->get_course_product_id(); $product = wc_get_product($product_id); if (! $product_id || ! $product){ return; } /** * Add required loggedin class * @since v 1.5.5 */ $isLoggedIn = is_user_logged_in(); $enable_guest_course_cart = tutor_utils()->get_option('enable_guest_course_cart'); $required_loggedin_class = ''; $ajax_add_to_cart_class = ''; if ( ! $isLoggedIn && ! $enable_guest_course_cart){ $required_loggedin_class = apply_filters('tutor_enroll_required_login_class', 'cart-required-login'); } else { $ajax_add_to_cart_class = $product->supports( 'ajax_add_to_cart' ) ? 'ajax_add_to_cart' : ''; } $args = array(); $defaults = array( 'quantity' => 1, 'class' => implode( ' ', array_filter( array( 'button btn-purchase', 'product_type_' . $product->get_type(), $product->is_purchasable() && $product->is_in_stock() ? 'add_to_cart_button' : '', $ajax_add_to_cart_class, $required_loggedin_class ) ) ), 'attributes' => array( 'data-product_id' => $product->get_id(), 'data-product_sku' => $product->get_sku(), 'aria-label' => $product->add_to_cart_description(), 'rel' => 'nofollow', ), ); $args = apply_filters( 'woocommerce_loop_add_to_cart_args', wp_parse_args( $args, $defaults ), $product ); if ( isset( $args['attributes']['aria-label'] ) ) { $args['attributes']['aria-label'] = strip_tags( $args['attributes']['aria-label'] ); } ?> <div class="tutor-loop-cart-btn-wrap"> <?php echo apply_filters( 'tutor_course_restrict_new_entry', apply_filters( 'woocommerce_loop_add_to_cart_link', // WPCS: XSS ok. sprintf( '<a href="%s" data-quantity="%s" class="%s" %s>%s</a>', esc_url( $product->add_to_cart_url() ), esc_attr( isset( $args['quantity'] ) ? $args['quantity'] : 1 ), esc_attr( isset( $args['class'] ) ? $args['class'] : 'button' ), isset( $args['attributes'] ) ? wc_implode_html_attributes( $args['attributes'] ) : '', esc_html( $product->add_to_cart_text() ) ), $product, $args ) ); ?> </div>
Name | Type | Size | Permission | Actions |
---|---|---|---|---|
content | Folder | 0755 |
|
|
add-to-cart-edd.php | File | 1.13 KB | 0644 |
|
add-to-cart-woocommerce.php | File | 2.19 KB | 0644 |
|
course-author.php | File | 342 B | 0644 |
|
course-continue.php | File | 499 B | 0644 |
|
course-in-cart.php | File | 566 B | 0644 |
|
course-price-edd.php | File | 895 B | 0644 |
|
course-price-woocommerce.php | File | 796 B | 0644 |
|
course-price.php | File | 789 B | 0644 |
|
course.php | File | 211 B | 0644 |
|
end_content_wrap.php | File | 74 B | 0644 |
|
footer.php | File | 2.01 KB | 0644 |
|
header.php | File | 1.06 KB | 0644 |
|
loop-after-content.php | File | 130 B | 0644 |
|
loop-before-content.php | File | 130 B | 0644 |
|
loop-end.php | File | 137 B | 0644 |
|
loop-start.php | File | 1.34 KB | 0644 |
|
meta.php | File | 1.31 KB | 0644 |
|
rating.php | File | 510 B | 0644 |
|
start_content_wrap.php | File | 95 B | 0644 |
|
title.php | File | 306 B | 0644 |
|
tutor-pagination.php | File | 691 B | 0644 |
|