2011-12-09 20:29:43 +00:00
< ? php
/**
2012-08-14 18:05:45 +00:00
* Cart totals
*
* @ author WooThemes
* @ package WooCommerce / Templates
* @ version 1.6 . 4
2011-12-09 20:29:43 +00:00
*/
2012-08-14 18:05:45 +00:00
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-02-23 10:01: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-01-05 11:31:22 +00:00
< h2 >< ? php _e ( 'Cart Totals' , 'woocommerce' ); ?> </h2>
2011-12-09 20:29:43 +00:00
< table cellspacing = " 0 " cellpadding = " 0 " >
< tbody >
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
< tr class = " cart-subtotal " >
2012-01-05 11:31:22 +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
2011-12-30 21:11:18 +00:00
< ? php if ( $woocommerce -> cart -> get_discounts_before_tax ()) : ?>
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
< tr class = " discount " >
2012-02-18 10:08:12 +00:00
< 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>
2011-12-30 21:11:18 +00:00
< 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-08-14 18:05:45 +00:00
2012-04-11 12:08:04 +00:00
< ? php if ( $woocommerce -> cart -> needs_shipping () && $woocommerce -> cart -> show_shipping () && ( $available_methods || get_option ( 'woocommerce_enable_shipping_calc' ) == 'yes' ) ) { ?>
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
< tr class = " shipping " >
2012-01-05 11:31:22 +00:00
< th >< ? php _e ( 'Shipping' , 'woocommerce' ); ?> </th>
2011-12-30 21:11:18 +00:00
< td >
< ? php
2012-02-11 13:46:54 +00:00
// If at least one shipping method is available
if ( $available_methods ) {
// Prepare text labels with price for each shipping method
foreach ( $available_methods as $method ) {
2012-02-13 09:16:22 +00:00
$method -> full_label = esc_html ( $method -> label );
2012-02-11 13:46:54 +00:00
if ( $method -> cost > 0 ) {
2012-05-13 20:02:07 +00:00
$method -> full_label .= ': ' ;
2012-02-11 13:46:54 +00:00
// Append price to label using the correct tax settings
2012-06-10 14:48:52 +00:00
if ( $woocommerce -> cart -> display_totals_ex_tax || ! $woocommerce -> cart -> prices_include_tax || $woocommerce -> customer -> is_vat_exempt () ) {
2012-02-11 13:46:54 +00:00
$method -> full_label .= woocommerce_price ( $method -> cost );
if ( $method -> get_shipping_tax () > 0 && $woocommerce -> cart -> prices_include_tax ) {
$method -> full_label .= ' ' . $woocommerce -> countries -> ex_tax_or_vat ();
}
} else {
$method -> full_label .= woocommerce_price ( $method -> cost + $method -> get_shipping_tax () );
if ( $method -> get_shipping_tax () > 0 && ! $woocommerce -> cart -> prices_include_tax ) {
$method -> full_label .= ' ' . $woocommerce -> countries -> inc_tax_or_vat ();
}
}
}
}
// Print a single available shipping method as plain text
if ( 1 === count ( $available_methods ) ) {
2012-05-13 20:02:07 +00:00
echo $method -> full_label . '<input type="hidden" name="shipping_method" id="shipping_method" value="' . esc_attr ( $method -> id ) . '" />' ;
2012-02-11 13:46:54 +00:00
2012-05-13 20:02:07 +00:00
// Show multiple shipping methods
2012-02-11 13:46:54 +00:00
} else {
2012-08-14 18:05:45 +00:00
2012-05-13 20:02:07 +00:00
if ( get_option ( 'woocommerce_shipping_method_format' ) == 'select' ) {
2012-02-11 13:46:54 +00:00
2012-05-13 20:02:07 +00:00
echo '<select name="shipping_method" id="shipping_method">' ;
2012-08-14 18:05:45 +00:00
foreach ( $available_methods as $method )
2012-05-13 20:02:07 +00:00
echo '<option value="' . esc_attr ( $method -> id ) . '" ' . selected ( $method -> id , $_SESSION [ '_chosen_shipping_method' ], false ) . '>' . strip_tags ( $method -> full_label ) . '</option>' ;
2012-02-11 13:46:54 +00:00
2012-05-13 20:02:07 +00:00
echo '</select>' ;
2012-08-14 18:05:45 +00:00
2012-05-13 20:02:07 +00:00
} else {
2012-08-14 18:05:45 +00:00
2012-05-13 20:02:07 +00:00
echo '<ul id="shipping_method">' ;
2012-08-14 18:05:45 +00:00
2012-05-13 20:02:07 +00:00
foreach ( $available_methods as $method )
echo '<li><input type="radio" name="shipping_method" id="shipping_method_' . sanitize_title ( $method -> id ) . '" value="' . esc_attr ( $method -> id ) . '" ' . checked ( $method -> id , $_SESSION [ '_chosen_shipping_method' ], false ) . ' /> <label for="shipping_method_' . sanitize_title ( $method -> id ) . '">' . $method -> full_label . '</label></li>' ;
2012-08-14 18:05:45 +00:00
2012-05-13 20:02:07 +00:00
echo '</ul>' ;
2012-08-14 18:05:45 +00:00
2012-05-13 20:02:07 +00:00
}
2012-08-14 18:05:45 +00:00
2012-02-11 13:46:54 +00:00
}
// No shipping methods are available
} else {
if ( ! $woocommerce -> customer -> get_shipping_country () || ! $woocommerce -> customer -> get_shipping_state () || ! $woocommerce -> customer -> get_shipping_postcode () ) {
2012-02-15 15:33:36 +00:00
echo '<p>' . __ ( 'Please fill in your details to see available shipping methods.' , 'woocommerce' ) . '</p>' ;
2012-02-11 13:46:54 +00:00
} else {
2012-01-05 11:31:22 +00:00
echo '<p>' . __ ( 'Sorry, it seems that there are no available shipping methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.' , 'woocommerce' ) . '</p>' ;
2012-02-11 13:46:54 +00:00
}
}
2011-12-30 21:11:18 +00:00
?> </td>
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
</ tr >
2012-08-14 18:05:45 +00:00
2012-04-11 11:00:56 +00:00
< ? php } ?>
2012-08-14 18:05:45 +00:00
< ? php
2012-05-09 17:29:22 +00:00
if ( get_option ( 'woocommerce_display_cart_taxes' ) == 'yes' && $woocommerce -> cart -> get_cart_tax () ) :
2012-08-14 18:05:45 +00:00
2012-05-23 05:24:04 +00:00
$taxes = $woocommerce -> cart -> get_formatted_taxes ();
2012-08-14 18:05:45 +00:00
2012-01-27 15:00:03 +00:00
if ( sizeof ( $taxes ) > 0 ) :
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
$has_compound_tax = false ;
2012-08-14 18:05:45 +00:00
foreach ( $taxes as $key => $tax ) :
2012-01-14 16:42:04 +00:00
if ( $woocommerce -> cart -> tax -> is_compound ( $key )) : $has_compound_tax = true ; continue ; endif ;
2011-12-30 21:11:18 +00:00
?>
< tr class = " tax-rate tax-rate-<?php echo $key ; ?> " >
2012-05-10 07:42:43 +00:00
< th >
< ? php
if ( get_option ( 'woocommerce_display_totals_excluding_tax' ) == 'no' && get_option ( 'woocommerce_prices_include_tax' ) == 'yes' ) {
2012-06-29 19:45:09 +00:00
_e ( 'incl. ' , 'woocommerce' );
2012-05-10 07:42:43 +00:00
}
echo $woocommerce -> cart -> tax -> get_rate_label ( $key );
?>
</ th >
2012-05-23 05:24:04 +00:00
< td >< ? php echo $tax ; ?> </td>
2011-12-30 21:11:18 +00:00
</ tr >
< ? php
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
endforeach ;
2012-08-14 18:05:45 +00:00
2012-01-04 23:01:47 +00:00
if ( $has_compound_tax && ! $woocommerce -> cart -> prices_include_tax ) :
2011-12-30 21:11:18 +00:00
?>
< tr class = " order-subtotal " >
2012-01-05 11:31:22 +00:00
< th >< strong >< ? php _e ( 'Subtotal' , 'woocommerce' ); ?> </strong></th>
2011-12-30 21:11:18 +00:00
< td >< strong >< ? php echo $woocommerce -> cart -> get_cart_subtotal ( true ); ?> </strong></td>
</ tr >
< ? php
endif ;
2012-08-14 18:05:45 +00:00
foreach ( $taxes as $key => $tax ) :
2012-01-14 16:42:04 +00:00
if ( ! $woocommerce -> cart -> tax -> is_compound ( $key )) continue ;
2011-12-30 21:11:18 +00:00
?>
< tr class = " tax-rate tax-rate-<?php echo $key ; ?> " >
2012-05-10 07:42:43 +00:00
< th >
< ? php
if ( get_option ( 'woocommerce_display_totals_excluding_tax' ) == 'no' && get_option ( 'woocommerce_prices_include_tax' ) == 'yes' ) {
2012-06-29 19:45:09 +00:00
_e ( 'incl. ' , 'woocommerce' );
2012-05-10 07:42:43 +00:00
}
echo $woocommerce -> cart -> tax -> get_rate_label ( $key );
?>
</ th >
2012-05-23 05:24:04 +00:00
< td >< ? php echo $tax ; ?> </td>
2011-12-30 21:11:18 +00:00
</ tr >
< ? php
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
endforeach ;
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
else :
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
?>
< tr class = " tax " >
2012-01-05 11:31:22 +00:00
< th >< ? php _e ( 'Tax' , 'woocommerce' ); ?> </th>
2011-12-30 21:11:18 +00:00
< td >< ? php echo $woocommerce -> cart -> get_cart_tax (); ?> </td>
</ tr >
< ? php
2012-08-14 18:05:45 +00:00
endif ;
2012-05-09 17:29:22 +00:00
elseif ( get_option ( 'woocommerce_display_cart_taxes_if_zero' ) == 'yes' ) :
2012-08-14 18:05:45 +00:00
2012-03-12 16:14:00 +00:00
?>
< tr class = " tax " >
< th >< ? php _e ( 'Tax' , 'woocommerce' ); ?> </th>
< td >< ? php _ex ( 'N/A' , 'Relating to tax' , 'woocommerce' ); ?> </td>
</ tr >
< ? php
2012-08-14 18:05:45 +00:00
2011-12-30 19:36:44 +00:00
endif ;
?>
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
< ? php if ( $woocommerce -> cart -> get_discounts_after_tax ()) : ?>
2012-08-14 18:05:45 +00:00
2011-12-30 21:11:18 +00:00
< tr class = " discount " >
2012-02-18 10:08:12 +00:00
< 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>
2011-12-30 21:11:18 +00:00
< 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
2011-12-30 21:11:18 +00:00
< tr class = " total " >
2012-01-05 11:31:22 +00:00
< th >< strong >< ? php _e ( 'Order Total' , 'woocommerce' ); ?> </strong></th>
2012-08-14 18:05:45 +00:00
< td >< strong >< ? php
2012-01-09 18:00:52 +00:00
if ( get_option ( 'woocommerce_display_cart_taxes' ) == 'no' && ! $woocommerce -> cart -> prices_include_tax ) :
2012-08-14 18:05:45 +00:00
echo $woocommerce -> cart -> get_total_ex_tax ();
2012-01-09 18:00:52 +00:00
else :
2012-08-14 18:05:45 +00:00
echo $woocommerce -> cart -> get_total ();
2012-01-09 18:00:52 +00:00
endif ;
2012-08-14 18:05:45 +00:00
2012-01-09 18:00:52 +00:00
?> </strong></td>
2011-12-30 21:11:18 +00:00
</ tr >
2012-08-14 18:05:45 +00:00
2011-12-09 20:29:43 +00:00
</ tbody >
</ table >
2012-08-14 18:05:45 +00:00
2012-06-05 13:18:09 +00:00
< ? php if ( get_option ( 'woocommerce_display_cart_taxes' ) == 'yes' && $woocommerce -> cart -> get_cart_tax () ) : ?>
2012-08-14 18:05:45 +00:00
< p >< small >< ? php
2012-06-05 13:18:09 +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
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-06-05 13:18:09 +00:00
?> </small></p>
< ? 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
2012-01-13 12:11:48 +00:00
< div class = " woocommerce_info " >
< p >< ? php _e ( 'No shipping methods were found; please recalculate your shipping and enter your state/county and zip/postcode to ensure their are no other available methods for your location.' , 'woocommerce' ); ?> </p>
</ 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
2012-01-13 12:11:48 +00:00
< div class = " woocommerce_error " >
2012-08-14 18:05:45 +00:00
2012-01-13 12:11:48 +00:00
< p >< ? php printf ( __ ( 'Sorry, it seems that there are no available shipping methods for your location (%s).' , 'woocommerce' ), $woocommerce -> countries -> countries [ $woocommerce -> customer -> get_shipping_country () ]); ?> </p>
2012-08-14 18:05:45 +00:00
2012-01-13 12:11:48 +00:00
< p >< ? php _e ( 'If you require assistance or wish to make alternate arrangements please contact us.' , 'woocommerce' ); ?> </p>
2012-08-14 18:05:45 +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 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-02-23 10:01:15 +00:00
< ? php do_action ( 'woocommerce_after_cart_totals' ); ?>
2012-08-14 18:05:45 +00:00
2011-12-09 20:29:43 +00:00
</ div >