| Server IP : 65.108.144.40 / Your IP : 216.73.217.165 Web Server : Apache/2.4.52 (Ubuntu) System : Linux ubuntu-8gb-hel1-1 5.15.0-173-generic #183-Ubuntu SMP Fri Mar 6 13:29:34 UTC 2026 x86_64 User : dev ( 1000) PHP Version : 8.2.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/html/coopermain/wp-content/themes/cooper/woocommerce/cart/ |
Upload File : |
<?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;
use function wc_util_functions\get_reformatted_price_html;
use function wc_util_functions\price_html_custom;
do_action('woocommerce_before_cart'); ?>
<form class="woocommerce-cart-form" action="<?php echo esc_url(wc_get_cart_url()); ?>" method="post">
<?php do_action('woocommerce_before_cart_table'); ?>
<table class="shop_table cart woocommerce-cart-form__contents" cellspacing="0">
<tbody>
<?php do_action('woocommerce_before_cart_contents'); ?>
<?php
/**
* Workaround for plugin limitation
*
* usually it's impossible for the same product / variation to be inserted into the cart twice; if this is the case,
* then it's safe to assume the second instance was added by the plugin with a modified price
*********************************************/
$products_count = [];
$i = 1;
foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {
if ($products_count[$cart_item['variation_id']]) {
++$products_count[$cart_item['variation_id']];
} else {
$products_count[$cart_item['variation_id']] = 1;
}
}
/** ******************************************/
$extras_tooltips = [
\LambAgency\WcExtraCostsManager\WcExtraCostsManager::get_regional_surchage_prod_id() => [
'copy' => 'This is a mandatory per tyre fee based on your fitter selection', 'link' => false
],
\LambAgency\WcExtraCostsManager\WcExtraCostsManager::get_tyre_disposal_prod_id() => [
'copy' => 'This is a mandatory per tyre fee based on your fitter selection', 'link' => false
],
\LambAgency\WcExtraCostsManager\WcExtraCostsManager::get_discount_fee_prod_id() => [
'copy' => 'This a per tyre discount passed on to you by your chosen fitter', 'link' => false
],
];
?>
<?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);
$variation_id = $_product->get_type() === 'variation' ? $cart_item['variation_id'] : $product_id;
$price = $_product->is_on_sale() ? $_product->get_sale_price() : $_product->get_regular_price();
$is_valid_for_bonus = array_key_exists($variation_id, $products_count) && $products_count[$variation_id] === 1; //check if bonus offer conditions are met, stops repeating logic
$is_discounted = $cart_item['data']->get_price() < $price;
$is_not_extra_cost = !in_array($_product->get_id(),
\LambAgency\WcExtraCostsManager\WcExtraCostsManager::get_fee_prod_ids(), false);
$is_discount_extra = $cart_item['data']->get_id() == \LambAgency\WcExtraCostsManager\WcExtraCostsManager::get_discount_fee_prod_id();
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 data-cart-index="<?= $i ?>" class="woocommerce-cart-form__cart-item from-cart
<?= $is_discounted ? "bonus-tyre " : " " . esc_attr(apply_filters('woocommerce_cart_item_class', 'cart_item', $cart_item, $cart_item_key)) ?>">
<?php if ($is_not_extra_cost): ?>
<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 class="product-thumbnail-link" href="%s">%s</a>', esc_url($product_permalink), $thumbnail); // PHPCS: XSS ok.
}
?>
</td>
<?php endif; ?>
<td class="product-name <?= ($is_not_extra_cost ? '' : 'is-extra ' . str_replace(' ', '-', strtolower($_product->get_name()) )) ?>"
<?= $is_not_extra_cost ? '' : 'colspan=2' ?>
data-title="<?php esc_attr_e('Product', 'woocommerce'); ?>">
<div class="name-name">
<?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>', $variation_id));
} ?>
</div>
<!-- Price per item -->
<div class="<?= $is_discount_extra ? 'discount-per-item' : ''?>">
<?= price_html_custom($_product, $cart_item, $cart_item_key, false) ?>
</div>
</td>
<td class="product-quantity <?= ($is_not_extra_cost ? '' : 'is-extra ') ?>"
data-title="<?php esc_attr_e('Quantity', 'woocommerce'); ?>">
<div class="grid-x align-middle align-center">
<?php if (!$_product->is_sold_individually() && $is_not_extra_cost): ?>
<div class='quantity-control quantity-control-minus'>
<button type='button'>-</button>
</div>
<?php endif; ?>
<?php if($is_not_extra_cost) {
$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.
} else {?>
<div class="extra-item-qty"><?= $cart_item['quantity'] ?></div>
<?php } ?>
<?php if (!$_product->is_sold_individually() && $is_not_extra_cost): ?>
<div class='quantity-control quantity-control-plus'>
<button type='button'>+</button>
</div>
<?php endif; ?>
</div>
</td>
<td class="product-subtotal <?= ($is_not_extra_cost ? '' : 'is-extra ').(str_replace(' ', '-', strtolower($_product->get_name()) )) ?>"
data-title="<?php esc_attr_e('Subtotal', 'woocommerce'); ?>">
<h2 style="display: inline-block">
<?php
$price = WC()->cart->get_product_subtotal( $_product, $cart_item['quantity'] );
if ($is_discount_extra) {
$price = ( str_replace('-', '', html_entity_decode($price)) );
}
echo get_reformatted_price_html($price, false);
?>
</h2>
</td>
<td class="product-remove <?= $is_not_extra_cost ? '' : 'is-extra' ?>">
<?php if ($is_not_extra_cost) {
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
);
} else {
$content = $extras_tooltips[$cart_item['data']->get_id()];
$tooltip = new \LambAgency\Components\ComponentTooltip(
$content['copy'],
$content['link']
);
$tooltip->dir = 'right';
$tooltip->render();
}?>
</td>
</tr>
<?php
$rule_will_be_active = WDP_Functions::get_active_rules_for_product($cart_item['variation_id']);
if ($is_valid_for_bonus && count($rule_will_be_active) > 0): ?>
<tr class="bonus-offer-row" data-cart-index="<?= $i ?>">
<td colspan="6" style="padding-left: 0; padding-right: 0">
<?php include __DIR__ . '/../inc/front-end/template-pricing-desc.php'; ?>
</td>
</tr>
<?php endif;
}
$i++;
}
?>
<?php do_action('woocommerce_cart_contents'); ?>
<tr class="order-total" style="border-top: solid 1px">
<td class="w-50 py-3" colspan="2">
<h4>TOTAL</h4>
<?php if(wc_tax_enabled() && WC()->cart->display_prices_including_tax()): ?>
<p class="my-0">incl. GST</p>
<?php endif; ?>
</td>
<td class="w-50 text-right py-3" colspan="2">
<h2><?php wc_cart_totals_order_total_html(); ?></h2>
</td>
<td class="w-100 text-center"><?= __('All Charges are made in ') . get_woocommerce_currency() ?>.</td>
</tr>
<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'); ?>
<button type="button" class="button button-next-step"><?= __("Continue", "cooper-tyres") ?></button>
</td>
</tr>
<?php do_action('woocommerce_after_cart_contents'); ?>
</tbody>
</table>
<?php do_action('woocommerce_after_cart_table'); ?>
</form>
<?php do_action('woocommerce_before_cart_collaterals'); ?>
<div class="cart-collaterals">
<?php
/**
* Cart collaterals hook.
*
* @hooked woocommerce_cross_sell_display
* @hooked woocommerce_cart_totals - 10
*/
do_action('woocommerce_cart_collaterals');
?>
</div>
<?php do_action('woocommerce_after_cart'); ?>