File: /storage/v4513/ivenusin/public_html/wp-content/themes/ivenus/woocommerce/cart/cart.php
<?php
/**
* Cart Page
*
* This template can be overridden by copying it to yourtheme/woocommerce/cart/cart.php.
*
* HOWEVER, on occasion WooCommerce will need to update template files and you
* (the theme developer) will need to copy the new files to your theme to
* maintain compatibility. We try to do this as little as possible, but it does
* happen. When this occurs the version of the template file will be bumped and
* the readme will list any important changes.
*
* @see https://docs.woocommerce.com/document/template-structure/
* @package WooCommerce/Templates
* @version 3.8.0
*/
defined( 'ABSPATH' ) || exit;
do_action( 'woocommerce_before_cart' ); ?>
<div class="row cart">
<form class="woocommerce-cart-form col-lg-9" action="<?php echo esc_url( wc_get_cart_url() ); ?>" method="post">
<?php do_action( 'woocommerce_before_cart_table' ); ?>
<table class="shop_table shop_table_responsive cart woocommerce-cart-form__contents table table-cart table-mobile" cellspacing="0">
<thead>
<tr>
<th class="product-remove"> </th>
<th class="product-thumbnail"> </th>
<th class="product-name"><?php esc_html_e( 'Product', 'woocommerce' ); ?></th>
<th class="product-price"><?php esc_html_e( 'Price', 'woocommerce' ); ?></th>
<th class="product-quantity"><?php esc_html_e( 'Quantity', 'woocommerce' ); ?></th>
<th class="product-subtotal"><?php esc_html_e( 'Subtotal', 'woocommerce' ); ?></th>
</tr>
</thead>
<tbody>
<?php do_action( 'woocommerce_before_cart_contents' ); ?>
<?php
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$_product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
if ( $_product && $_product->exists() && $cart_item['quantity'] > 0 && apply_filters( 'woocommerce_cart_item_visible', true, $cart_item, $cart_item_key ) ) {
$product_permalink = apply_filters( 'woocommerce_cart_item_permalink', $_product->is_visible() ? $_product->get_permalink( $cart_item ) : '', $cart_item, $cart_item_key );
?>
<tr class="woocommerce-cart-form__cart-item <?php echo esc_attr( apply_filters( 'woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key ) ); ?>">
<td class="product-remove">
<?php
echo apply_filters( // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
'woocommerce_cart_item_remove_link',
sprintf(
'<a href="%s" class="remove" aria-label="%s" data-product_id="%s" data-product_sku="%s">×</a>',
esc_url( wc_get_cart_remove_url( $cart_item_key ) ),
esc_html__( 'Remove this item', 'woocommerce' ),
esc_attr( $product_id ),
esc_attr( $_product->get_sku() )
),
$cart_item_key
);
?>
</td>
<td class="product-thumbnail">
<?php
$thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image(), $cart_item, $cart_item_key );
if ( ! $product_permalink ) {
echo $thumbnail; // PHPCS: XSS ok.
} else {
printf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $thumbnail ); // PHPCS: XSS ok.
}
?>
</td>
<td class="product-name" data-title="<?php esc_attr_e( 'Product', 'woocommerce' ); ?>">
<?php
if ( ! $product_permalink ) {
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', $_product->get_name(), $cart_item, $cart_item_key ) . ' ' );
} else {
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_name', sprintf( '<a href="%s">%s</a>', esc_url( $product_permalink ), $_product->get_name() ), $cart_item, $cart_item_key ) );
}
do_action( 'woocommerce_after_cart_item_name', $cart_item, $cart_item_key );
// Meta data.
echo wc_get_formatted_cart_item_data( $cart_item ); // PHPCS: XSS ok.
// Backorder notification.
if ( $_product->backorders_require_notification() && $_product->is_on_backorder( $cart_item['quantity'] ) ) {
echo wp_kses_post( apply_filters( 'woocommerce_cart_item_backorder_notification', '<p class="backorder_notification">' . esc_html__( 'Available on backorder', 'woocommerce' ) . '</p>', $product_id ) );
}
?>
</td>
<td class="product-price" data-title="<?php esc_attr_e( 'Price', 'woocommerce' ); ?>">
<?php
echo apply_filters( 'woocommerce_cart_item_price', WC()->cart->get_product_price( $_product ), $cart_item, $cart_item_key ); // PHPCS: XSS ok.
?>
</td>
<td class="product-quantity" data-title="<?php esc_attr_e( 'Quantity', 'woocommerce' ); ?>">
<?php
if ( $_product->is_sold_individually() ) {
$product_quantity = sprintf( '1 <input type="hidden" name="cart[%s][qty]" value="1" />', $cart_item_key );
} else {
$product_quantity = woocommerce_quantity_input(
array(
'input_name' => "cart[{$cart_item_key}][qty]",
'input_value' => $cart_item['quantity'],
'max_value' => $_product->get_max_purchase_quantity(),
'min_value' => '0',
'product_name' => $_product->get_name(),
),
$_product,
false
);
}
echo apply_filters( 'woocommerce_cart_item_quantity', $product_quantity, $cart_item_key, $cart_item ); // PHPCS: XSS ok.
?>
</td>
<td class="product-subtotal" data-title="<?php esc_attr_e( 'Subtotal', 'woocommerce' ); ?>">
<?php
echo apply_filters( 'woocommerce_cart_item_subtotal', WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] ), $cart_item, $cart_item_key ); // PHPCS: XSS ok.
?>
</td>
</tr>
<?php
}
}
?>
<?php do_action( 'woocommerce_cart_contents' ); ?>
<tr>
<td colspan="6" class="actions">
<?php if ( wc_coupons_enabled() ) { ?>
<div class="coupon">
<label for="coupon_code"><?php esc_html_e( 'Coupon:', 'woocommerce' ); ?></label> <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" placeholder="<?php esc_attr_e( 'Coupon code', 'woocommerce' ); ?>" /> <button type="submit" class="button" name="apply_coupon" value="<?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?>"><?php esc_attr_e( 'Apply coupon', 'woocommerce' ); ?></button>
<?php do_action( 'woocommerce_cart_coupon' ); ?>
</div>
<?php } ?>
<button type="submit" class="button" name="update_cart" value="<?php esc_attr_e( 'Update cart', 'woocommerce' ); ?>"><?php esc_html_e( 'Update cart', 'woocommerce' ); ?></button>
<?php do_action( 'woocommerce_cart_actions' ); ?>
<?php wp_nonce_field( 'woocommerce-cart', 'woocommerce-cart-nonce' ); ?>
</td>
</tr>
<?php do_action( 'woocommerce_after_cart_contents' ); ?>
</tbody>
</table>
<?php do_action( 'woocommerce_after_cart_table' ); ?>
<div class="related_products_div">
<?php
$c = 0;
$product_arr = array();
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
if($c!=0) {
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
$product_arr[] = $product_id;
}
$c++;
}
$c = 0;
foreach ( WC()->cart->get_cart() as $cart_item_key => $cart_item ) {
$product = apply_filters( 'woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key );
$product_id = apply_filters( 'woocommerce_cart_item_product_id', $cart_item['product_id'], $cart_item, $cart_item_key );
foreach($terms as $term) {
$prod_cat_name = $term->name;
$prod_cat_link = get_term_link( $term );
$prod_cat_id = $term->term_id;
$prod_cat_parent = get_term_by( 'id', $term->parent, 'product_cat' );
$prod_cat_parent_slug = $prod_cat_parent->slug;
}
if($c == 0) {
?>
<section class="similar-products bg-white v_ivenus-custom-related" style="padding :20px 0;">
<?php
$related_accessories = get_field('related_accessories',$product_id);
$result = array_diff($related_accessories, $product_arr);
$final_related_arr = array_values($result);
?>
<div class="container">
<?php if( isset($related_accessories) && !empty($related_accessories) ){ ?>
<p class="title text-left mb-4"><?php echo 'You may need this:'; ?></p>
<?php } ?>
<div class="row">
<?php
if( isset($related_accessories) && !empty($related_accessories) ){
$rargs = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'date',
'order' => 'DESC',
'post__in' => $final_related_arr,
'meta_query' => array( array(
'key' => '_stock_status',
'value' => 'outofstock',
'compare' => '!=',
) ),
);
$featured_products = new WP_Query($rargs);
} else {
$rargs = array(
'post_type' => 'product',
'post_status' => 'publish',
'posts_per_page' => -1,
'orderby' => 'date',
'order' => 'DESC',
'post__not_in' => array($product_id),
'tax_query' => array(
array(
'taxonomy' => 'product_cat',
'field' => 'term_id',
'terms' => $prod_cat_id,
'operator' => 'IN' // Possible values are 'IN', 'NOT IN', 'AND'.
),
array(
'taxonomy' => 'product_visibility',
'field' => 'slug',
'terms' => 'exclude-from-catalog', // Possibly 'exclude-from-search' too
'operator' => 'NOT IN'
)
)
);
$featured_products = new WP_Query($rargs);
}
$featured_p = new WC_Product_Factory(); ?>
<?php
if ( $featured_products->have_posts() ) {
?>
<style>
.carousel-with-shadow .owl-stage-outer {
padding-top: 0px;
}
</style>
<div class="owl-carousel owl-simple carousel-equal-height carousel-with-shadow" data-toggle="owl"
data-owl-options='{
"dots": true,
"margin": 20,
"loop": false,
"responsive": {
"0": {
"items":2,
"nav": false
},
"480": {
"items":2,
"nav": false
},
"768": {
"items":3,
"nav": false
},
"992": {
"items":4,
"nav": false
},
"1200": {
"items":4,
"nav": true
},
"1600": {
"items":4,
"nav": true
}
}
}'>
<?php
while ( $featured_products->have_posts() ) : $featured_products->the_post();
$f_product_queried_object = get_queried_object();
$product = $featured_p->get_product(get_the_ID());
$attachment_ids = $product->get_gallery_attachment_ids();
$currency_symbol = get_woocommerce_currency_symbol();
$product_to_be_labeled_as_new = get_field('product_to_be_labeled_as_new',get_the_ID());
$product_detail_page_link = get_field('product_detail_page_link',get_the_ID());
if(!empty($product_detail_page_link)) {
$product_page_link = $product_detail_page_link.'?op='.$post->post_name;
} else {
$product_page_link = get_permalink( $product->ID );
}
$i = 0;
?>
<div class="product product-2">
<figure class="product-media">
<?php if( $product->is_on_sale() ) { ?>
<span class="product-label label-circle label-sale">Sale</span>
<?php } else { ?>
<?php if($product_to_be_labeled_as_new == 'Yes') { ?>
<span class="product-label label-circle label-new">New</span>
<?php } ?>
<?php } ?>
<a href="<?php echo $product_page_link; ?>">
<?php
$product_featured_image = wp_get_attachment_image_url( $product->get_image_id(),'product-listing-size' );
if(!empty($product_featured_image)) { ?>
<img src="<?php echo $product_featured_image; ?>" alt="<?php echo $product->get_title(); ?>" class="product-image">
<?php }
if(!empty($attachment_ids)) {
foreach( $attachment_ids as $attachment_id ) {
$Original_image_url = wp_get_attachment_image_url( $attachment_id,'product-listing-size' );
if( $i == 0 ) { ?>
<img src="<?php echo $Original_image_url; ?>" alt="<?php echo $product->get_title(); ?>" class="product-image-hover">
<?php }
$i++; }
} else { ?>
<img src="<?php echo $product_featured_image; ?>" alt="<?php echo $product->get_title(); ?>" class="product-image-hover">
<?php } ?>
</a>
<div class="product-action-vertical">
<?php echo do_shortcode('[yith_wcwl_add_to_wishlist product_id="'.$product->get_id().'"]'); ?>
</div><!-- End .product-action -->
<div class="product-action product-action-dark d-none">
<a href="<?php echo $product_page_link; ?>" class="btn-product btn-cart" title="Add to cart"><i class="fal fa-lightbulb-on"></i> <span>More Info</span></a>
<?php echo do_shortcode('[yith_compare_button product="'.$product->ID.'"]'); ?>
<!--<a href="#" class="btn-product btn-compare" title="Compare"><i class="fal fa-exchange"></i> <span>compare</span></a>-->
</div><!-- End .product-action -->
</figure><!-- End .product-media -->
<div class="product-body">
<h3 class="product-title" title="<?php echo get_the_title($product->ID); ?>"><a href="<?php echo $product_page_link; ?>"><?php echo get_the_title($product->ID); ?></a></h3><!-- End .product-title -->
<div class="product-price">
<?php
if( $product->is_type( 'simple' ) ) {
if( $product->is_on_sale() ) { ?>
<span class="new-price"><?php echo $currency_symbol.number_format($product->get_sale_price()); ?></span>
<span class="old-price"><?php echo $currency_symbol.number_format($product->get_regular_price()); ?></span>
<?php } else { ?>
<span class="new-price"><?php echo $currency_symbol.number_format($product->get_price()); ?></span>
<?php }
} elseif( $product->is_type( 'variable' ) ){
echo $product->get_price_html();
} ?>
</div><!-- End .product-price -->
<a href="<?php echo SITE_URL.'/cart/?add-to-cart='.$product->get_id(); ?>" class="btn ivenus-solid-btn"><i class="fal fa-shopping-cart"></i> Buy Now</a>
</div><!-- End .product-body -->
</div>
<?php
endwhile;
?>
</div>
<?php
} else {
//echo _e('<p>Thank you for your interest, but currently there are no featured products available. Please check back later.</p>');
}
wp_reset_postdata();
?>
</div>
</div>
</section>
<?php }
$c++; }
?>
</div>
</form>
<?php do_action( 'woocommerce_before_cart_collaterals' ); ?>
<div class="cart-collaterals col-lg-3 custom">
<?php
/**
* Cart collaterals hook.
*
* @hooked woocommerce_cross_sell_display
* @hooked woocommerce_cart_totals - 10
*/
do_action( 'woocommerce_cart_collaterals' );
?>
</div>
</div>
<?php do_action( 'woocommerce_after_cart' ); ?>