✏️ 正在编辑: mini-cart.php
路径:
/home/h359620/public_html/wp-content/themes/datis/woocommerce/cart/mini-cart.php
提示:
您可以编辑任何文件(包括二进制文件),但请注意不当修改可能导致文件损坏。
<?php /** * Mini-cart * * @package WooCommerce\Templates * @version 10.0.0 */ defined('ABSPATH') || exit; if (!function_exists('WC') || !WC()->cart) { return; } $cart_items = WC()->cart->get_cart(); $cart_is_empty = empty($cart_items); ?> <div class="mini-cart"> <div class="mini-cart-wrapper"> <div class="mini-cart-header"> <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M13.75 7.19167C13.4083 7.19167 13.125 6.90833 13.125 6.56667V5.41667C13.125 4.54167 12.75 3.69167 12.1 3.1C11.4417 2.5 10.5917 2.225 9.69167 2.30833C8.19167 2.45 6.875 3.98333 6.875 5.58333V6.39167C6.875 6.73333 6.59167 7.01667 6.25 7.01667C5.90833 7.01667 5.625 6.73333 5.625 6.39167V5.575C5.625 3.33333 7.43333 1.26667 9.575 1.05833C10.825 0.941667 12.025 1.33333 12.9417 2.175C13.85 3 14.375 4.18333 14.375 5.41667V6.56667C14.375 6.90833 14.0917 7.19167 13.75 7.19167Z" fill="var(--datis-primary-color)" /> <path d="M12.4998 18.9583H7.49985C3.64985 18.9583 2.93318 17.1667 2.74985 15.425L2.12485 10.4333C2.03318 9.53333 1.99985 8.24166 2.87485 7.275C3.62485 6.44166 4.86652 6.04166 6.66652 6.04166H13.3332C15.1415 6.04166 16.3832 6.45 17.1248 7.275C17.9915 8.24166 17.9665 9.53333 17.8748 10.4167L17.2498 15.425C17.0665 17.1667 16.3498 18.9583 12.4998 18.9583ZM6.66652 7.29166C5.25818 7.29166 4.29152 7.56666 3.79985 8.11666C3.39152 8.56666 3.25818 9.25833 3.36652 10.2917L3.99152 15.2833C4.13318 16.6167 4.49985 17.7167 7.49985 17.7167H12.4998C15.4998 17.7167 15.8665 16.625 16.0082 15.3L16.6332 10.2917C16.7415 9.275 16.6082 8.58333 16.1998 8.125C15.7082 7.56666 14.7415 7.29166 13.3332 7.29166H6.66652Z" fill="var(--datis-primary-color)" /> <path d="M12.8505 10.9583C12.3838 10.9583 12.0088 10.5833 12.0088 10.125C12.0088 9.66666 12.3838 9.29166 12.8421 9.29166C13.3005 9.29166 13.6755 9.66666 13.6755 10.125C13.6755 10.5833 13.3088 10.9583 12.8505 10.9583Z" fill="var(--datis-primary-color)" /> <path d="M7.01647 10.9583C6.5498 10.9583 6.1748 10.5833 6.1748 10.125C6.1748 9.66666 6.5498 9.29166 7.00814 9.29166C7.46647 9.29166 7.84147 9.66666 7.84147 10.125C7.84147 10.5833 7.4748 10.9583 7.01647 10.9583Z" fill="var(--datis-primary-color)" /> </svg> <?php echo esc_html__('Your cart', 'datis'); ?> </div> <div class="mini-cart-content d-flex flex-column gap-3"> <?php if ($cart_is_empty) : ?> <div class="mini-cart-empty d-flex flex-column gap-2 justify-content-center align-items-center"> <img src="<?php echo DATIS_ASSETS . 'image/empty-cart.svg' ?>"> <?php echo esc_html__('Your cart is currently empty.', 'datis'); ?> </div> <?php else : ?> <?php foreach ($cart_items as $cart_item_key => $cart_item) : $_product = apply_filters('woocommerce_cart_item_product', $cart_item['data'], $cart_item, $cart_item_key); if (!$_product || !$_product->exists() || $cart_item['quantity'] <= 0) continue; $product_id = apply_filters('woocommerce_cart_item_product_id', $_product->get_id(), $cart_item, $cart_item_key); $product_name = apply_filters('woocommerce_cart_item_name', $_product->get_name(), $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 ); $thumbnail = apply_filters( 'woocommerce_cart_item_thumbnail', $_product->get_image('woocommerce_thumbnail', ['class' => 'mini-cart-thumb']), $cart_item, $cart_item_key ); $line_subtotal_html = WC()->cart->get_product_subtotal($_product, $cart_item['quantity']); $regular_price = $_product->get_regular_price(); $sale_price = $_product->get_sale_price(); $has_discount = $sale_price && $regular_price && floatval($sale_price) < floatval($regular_price); $regular_price_html = $has_discount ? wc_price(wc_get_price_to_display($_product, ['price' => $regular_price])) : ''; $remove_url = wc_get_cart_remove_url($cart_item_key); $qty = (int) $cart_item['quantity']; ?> <div class="cart-item d-flex align-items-center justify-content-start gap-2"> <a class="remove-item remove remove_from_cart_button" href="<?php echo esc_url($remove_url); ?>" aria-label="<?php echo esc_attr__('Remove this item', 'datis'); ?>" data-product_id="<?php echo esc_attr($product_id); ?>" data-cart_item_key="<?php echo esc_attr($cart_item_key); ?>" data-product_sku="<?php echo esc_attr($_product->get_sku()); ?>"> <!-- remove icon --> <svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg"> <path d="M7 13.2708C3.541 13.2708.729 10.4592.729 7S3.541.729 7 .729 13.271 3.541 13.271 7 10.459 13.2708 7 13.2708Z" fill="#E63946" /> <path d="M5.1 9.05 9.05 5.1" stroke="#fff" stroke-width="1.2" stroke-linecap="round" /> <path d="M9.05 9.05 5.1 5.1" stroke="#fff" stroke-width="1.2" stroke-linecap="round" /> </svg> </a> <div class="product-thumb"> <?php if ($product_permalink) echo '<a href="' . esc_url($product_permalink) . '">' . $thumbnail . '</a>'; else echo $thumbnail; ?> </div> <div class="product-details d-flex flex-column me-1"> <div class="product-title"> <?php if ($product_permalink) : ?> <a href="<?php echo esc_url($product_permalink); ?>"> <?php echo wp_kses_post($product_name); ?> </a> <?php else : ?> <?php echo wp_kses_post($product_name); ?> <?php endif; ?> </div> <div class="price-wrapper d-flex align-items-center justify-content-start gap-2"> <span class="qty"><?php echo esc_html($qty) . ' ' . __('pcs', 'datis'); ?></span> <?php if ($has_discount) : ?> <div class="regular-price"><?php echo wp_kses_post($regular_price_html); ?></div> <?php endif; ?> <div class="amount-price"><?php echo wp_kses_post($line_subtotal_html); ?></div> </div> </div> </div> <?php endforeach; ?> <?php endif; ?> </div> <div class="mini-cart-footer"> <div class="total-price d-flex flex-row justify-content-between align-items-center"> <span class="total-price-lable"><?php echo esc_html__('Amount due', 'datis'); ?></span> <div class="price"><?php echo wp_kses_post(WC()->cart->get_cart_subtotal()); ?></div> </div> <a href="<?php echo esc_url(wc_get_checkout_url()); ?>" class="checkout-btn"> <?php echo esc_html__('Checkout', 'datis'); ?> </a> <a href="<?php echo esc_url(wc_get_cart_url()); ?>" class="cartpage-btn"> <?php echo esc_html__('View cart', 'datis'); ?> </a> </div> </div> </div>
💾 保存文件
← 返回文件管理器