2011-12-09 20:29:43 +00:00
< ? php
/**
2012-08-14 18:05:45 +00:00
* Cart totals
*
* @ author WooThemes
* @ package WooCommerce / Templates
2012-12-03 19:19:58 +00:00
* @ version 2.0 . 0
2011-12-09 20:29:43 +00:00
*/
2012-08-14 18:05:45 +00:00
2012-10-15 10:57:58 +00:00
if ( ! defined ( 'ABSPATH' ) ) exit ; // Exit if accessed directly
2011-12-09 20:29:43 +00:00
global $woocommerce ;
$available_methods = $woocommerce -> shipping -> get_available_shipping_methods ();
?>
2012-05-09 17:29:22 +00:00
< div class = " cart_totals <?php if ( $woocommerce->customer ->has_calculated_shipping() ) echo 'calculated_shipping'; ?> " >
2012-08-14 18:05:45 +00:00
2012-11-09 21:15:15 +00:00
< ? php do_action ( 'woocommerce_before_cart_totals' ); ?>
2012-08-14 18:05:45 +00:00
2012-05-09 17:29:22 +00:00
< ? php if ( ! $woocommerce -> shipping -> enabled || $available_methods || ! $woocommerce -> customer -> get_shipping_country () || ! $woocommerce -> customer -> has_calculated_shipping () ) : ?>
2012-08-14 18:05:45 +00:00
2012-10-12 11:48:06 +00:00
< h2 >< ? php _e ( 'Cart Totals' , 'woocommerce' ); ?> </h2>
2012-11-09 21:15:15 +00:00
2012-10-12 11:48:06 +00:00
< table cellspacing = " 0 " >
2011-12-09 20:29:43 +00:00
< tbody >
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
< tr class = " cart-subtotal " >
2012-10-12 11:48:06 +00:00
< th >< strong >< ? php _e ( 'Cart Subtotal' , 'woocommerce' ); ?> </strong></th>
2011-12-30 21:11:18 +00:00
< td >< strong >< ? php echo $woocommerce -> cart -> get_cart_subtotal (); ?> </strong></td>
</ tr >
2012-08-14 18:05:45 +00:00
2012-10-12 11:48:06 +00:00
< ? php if ( $woocommerce -> cart -> get_discounts_before_tax () ) : ?>
2012-08-14 18:05:45 +00:00
2012-10-12 11:48:06 +00:00
< tr class = " discount " >
< th >< ? php _e ( 'Cart Discount' , 'woocommerce' ); ?> <a href="<?php echo add_query_arg( 'remove_discounts', '1', $woocommerce->cart->get_cart_url() ) ?>"><?php _e( '[Remove]', 'woocommerce' ); ?></a></th>
< td >-< ? php echo $woocommerce -> cart -> get_discounts_before_tax (); ?> </td>
</ tr >
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
< ? php endif ; ?>
2012-11-27 16:22:47 +00:00
2012-10-12 11:48:06 +00:00
< ? php if ( $woocommerce -> cart -> needs_shipping () && $woocommerce -> cart -> show_shipping () && ( $available_methods || get_option ( 'woocommerce_enable_shipping_calc' ) == 'yes' ) ) : ?>
2012-11-27 16:22:47 +00:00
2012-12-29 19:04:18 +00:00
< ? php do_action ( 'woocommerce_cart_totals_before_shipping' ); ?>
2012-10-12 11:48:06 +00:00
< tr class = " shipping " >
2013-05-16 13:08:34 +00:00
< th >< ? php _e ( 'Shipping and Handling' , 'woocommerce' ); ?> </th>
2012-11-09 21:15:15 +00:00
< td >< ? php woocommerce_get_template ( 'cart/shipping-methods.php' , array ( 'available_methods' => $available_methods ) ); ?> </td>
2012-10-12 11:48:06 +00:00
</ tr >
2012-11-27 16:22:47 +00:00
2012-12-29 19:04:18 +00:00
< ? php do_action ( 'woocommerce_cart_totals_after_shipping' ); ?>
2012-10-12 11:48:06 +00:00
< ? php endif ?>
2012-11-27 16:22:47 +00:00
2012-11-09 21:15:15 +00:00
< ? php foreach ( $woocommerce -> cart -> get_fees () as $fee ) : ?>
2012-11-27 16:22:47 +00:00
2012-11-09 21:15:15 +00:00
< tr class = " fee fee-<?php echo $fee->id ?> " >
< th >< ? php echo $fee -> name ?> </th>
2012-11-27 16:22:47 +00:00
< td >< ? php
2012-12-03 16:36:54 +00:00
if ( $woocommerce -> cart -> tax_display_cart == 'excl' )
2012-11-12 17:15:54 +00:00
echo woocommerce_price ( $fee -> amount );
else
echo woocommerce_price ( $fee -> amount + $fee -> tax );
?> </td>
2012-11-09 21:15:15 +00:00
</ tr >
2012-11-27 16:22:47 +00:00
2012-11-09 21:15:15 +00:00
< ? php endforeach ; ?>
2012-08-14 18:05:45 +00:00
< ? php
2012-11-12 17:15:54 +00:00
// Show the tax row if showing prices exclusive of tax only
2012-12-03 16:36:54 +00:00
if ( $woocommerce -> cart -> tax_display_cart == 'excl' ) {
2013-03-27 18:20:56 +00:00
foreach ( $woocommerce -> cart -> get_tax_totals () as $code => $tax ) {
echo '<tr class="tax-rate tax-rate-' . $code . ' " >
< th > ' . $tax->label . ' </ th >
< td > ' . $tax->formatted_amount . ' </ td >
2012-11-09 21:15:15 +00:00
</ tr > ' ;
2012-10-12 11:48:06 +00:00
}
}
2011-12-30 19:36:44 +00:00
?>
2012-08-14 18:05:45 +00:00
2012-10-12 11:48:06 +00:00
< ? php if ( $woocommerce -> cart -> get_discounts_after_tax () ) : ?>
2012-11-27 16:22:47 +00:00
2012-10-12 11:48:06 +00:00
< tr class = " discount " >
< th >< ? php _e ( 'Order Discount' , 'woocommerce' ); ?> <a href="<?php echo add_query_arg( 'remove_discounts', '2', $woocommerce->cart->get_cart_url() ) ?>"><?php _e( '[Remove]', 'woocommerce' ); ?></a></th>
< td >-< ? php echo $woocommerce -> cart -> get_discounts_after_tax (); ?> </td>
</ tr >
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
< ? php endif ; ?>
2012-08-14 18:05:45 +00:00
2012-12-29 19:04:18 +00:00
< ? php do_action ( 'woocommerce_cart_totals_before_order_total' ); ?>
2011-12-30 21:11:18 +00:00
< tr class = " total " >
2012-10-12 11:48:06 +00:00
< th >< strong >< ? php _e ( 'Order Total' , 'woocommerce' ); ?> </strong></th>
< td >
< strong >< ? php echo $woocommerce -> cart -> get_total (); ?> </strong>
< ? php
// If prices are tax inclusive, show taxes here
2012-12-03 16:36:54 +00:00
if ( $woocommerce -> cart -> tax_display_cart == 'incl' ) {
2012-11-30 15:12:03 +00:00
$tax_string_array = array ();
2013-03-27 18:20:56 +00:00
foreach ( $woocommerce -> cart -> get_tax_totals () as $code => $tax ) {
$tax_string_array [] = sprintf ( '%s %s' , $tax -> formatted_amount , $tax -> label );
}
2012-11-27 16:22:47 +00:00
2012-11-30 15:12:03 +00:00
if ( ! empty ( $tax_string_array ) ) {
echo '<small class="includes_tax">' . sprintf ( __ ( '(Includes %s)' , 'woocommerce' ), implode ( ', ' , $tax_string_array ) ) . '</small>' ;
2012-10-12 11:48:06 +00:00
}
}
?>
</ td >
2011-12-30 21:11:18 +00:00
</ tr >
2012-08-14 18:05:45 +00:00
2012-12-29 19:04:18 +00:00
< ? php do_action ( 'woocommerce_cart_totals_after_order_total' ); ?>
2011-12-09 20:29:43 +00:00
</ tbody >
</ table >
2012-08-14 18:05:45 +00:00
2012-10-12 11:48:06 +00:00
< ? php if ( $woocommerce -> cart -> get_cart_tax () ) : ?>
2012-11-27 16:22:47 +00:00
2012-08-14 18:05:45 +00:00
< p >< small >< ? php
2012-10-12 11:48:06 +00:00
$estimated_text = ( $woocommerce -> customer -> is_customer_outside_base () && ! $woocommerce -> customer -> has_calculated_shipping () ) ? sprintf ( ' ' . __ ( ' (taxes estimated for %s)' , 'woocommerce' ), $woocommerce -> countries -> estimated_for_prefix () . __ ( $woocommerce -> countries -> countries [ $woocommerce -> countries -> get_base_country () ], 'woocommerce' ) ) : '' ;
2012-08-14 18:05:45 +00:00
2012-10-12 11:48:06 +00:00
printf ( __ ( 'Note: Shipping and taxes are estimated%s and will be updated during checkout based on your billing and shipping information.' , 'woocommerce' ), $estimated_text );
2012-08-14 18:05:45 +00:00
2012-06-05 13:18:09 +00:00
?> </small></p>
2012-11-27 16:22:47 +00:00
2012-06-05 13:18:09 +00:00
< ? php endif ; ?>
2012-08-14 18:05:45 +00:00
2012-04-16 00:56:20 +00:00
< ? php elseif ( $woocommerce -> cart -> needs_shipping () ) : ?>
2012-08-14 18:05:45 +00:00
2012-04-11 12:08:04 +00:00
< ? php if ( ! $woocommerce -> customer -> get_shipping_state () || ! $woocommerce -> customer -> get_shipping_postcode () ) : ?>
2012-08-14 18:05:45 +00:00
2013-01-03 12:21:26 +00:00
< div class = " woocommerce-info " >
2012-10-12 11:48:06 +00:00
2012-10-16 09:45:33 +00:00
< p >< ? php _e ( 'No shipping methods were found; please recalculate your shipping and enter your state/county and zip/postcode to ensure there are no other available methods for your location.' , 'woocommerce' ); ?> </p>
2012-10-12 11:48:06 +00:00
2012-01-13 12:11:48 +00:00
</ div >
2012-08-14 18:05:45 +00:00
2012-01-13 12:11:48 +00:00
< ? php else : ?>
2012-08-14 18:05:45 +00:00
2013-03-20 13:04:06 +00:00
< ? php
2012-08-14 18:05:45 +00:00
2013-03-20 13:04:06 +00:00
$customer_location = $woocommerce -> countries -> countries [ $woocommerce -> customer -> get_shipping_country () ];
2012-08-14 18:05:45 +00:00
2013-03-20 13:04:06 +00:00
echo apply_filters ( 'woocommerce_cart_no_shipping_available_html' ,
'<div class="woocommerce-error"><p>' .
sprintf ( __ ( 'Sorry, it seems that there are no available shipping methods for your location (%s).' , 'woocommerce' ) . ' ' . __ ( 'If you require assistance or wish to make alternate arrangements please contact us.' , 'woocommerce' ), $customer_location ) .
'</p></div>'
);
2012-08-14 18:05:45 +00:00
2013-03-20 13:04:06 +00:00
?>
2012-08-14 18:05:45 +00:00
2012-01-13 12:11:48 +00:00
< ? php endif ; ?>
2012-08-14 18:05:45 +00:00
2011-12-09 20:29:43 +00:00
< ? php endif ; ?>
2012-08-14 18:05:45 +00:00
2012-11-09 21:15:15 +00:00
< ? php do_action ( 'woocommerce_after_cart_totals' ); ?>
2012-08-14 18:05:45 +00:00
2013-05-16 13:08:34 +00:00
</ div >