Merge remote-tracking branch 'upstream/master'

This commit is contained in:
Julian Jöris 2011-11-22 14:06:48 +01:00
commit 7d7fa33d70
11 changed files with 322 additions and 100 deletions

View File

@ -675,14 +675,6 @@ $woocommerce_settings['tax'] = apply_filters('woocommerce_tax_settings', array(
array( 'name' => __( 'Tax Options', 'woothemes' ), 'type' => 'title','desc' => '', 'id' => 'tax_options' ),
array(
'name' => __( 'Calculate Taxes', 'woothemes' ),
'desc' => __( 'Enable taxes and tax calculations', 'woothemes' ),
'id' => 'woocommerce_calc_taxes',
'std' => 'yes',
'type' => 'checkbox'
),
array(
'name' => __( 'Prices inclusive of tax', 'woothemes' ),
'desc' => __( 'Catalog Prices include tax', 'woothemes' ),
@ -704,6 +696,23 @@ $woocommerce_settings['tax'] = apply_filters('woocommerce_tax_settings', array(
'excluding' => __( 'price excluding tax', 'woothemes' )
)
),
array(
'name' => __( 'Tax calculations', 'woothemes' ),
'desc' => __( 'Enable taxes and tax calculations', 'woothemes' ),
'id' => 'woocommerce_calc_taxes',
'std' => 'yes',
'type' => 'checkbox',
'checkboxgroup' => 'start'
),
array(
'desc' => __( 'Round tax at subtotal level, instead of per line', 'woothemes' ),
'id' => 'woocommerce_tax_round_at_subtotal',
'std' => 'no',
'type' => 'checkbox',
'checkboxgroup' => 'end'
),
array(
'name' => __( 'Additional Tax classes', 'woothemes' ),

View File

@ -324,6 +324,8 @@ class woocommerce_cart {
*/
function get_discounted_price( $values, $price ) {
$this->discount_product = 0;
if ($this->applied_coupons) foreach ($this->applied_coupons as $code) :
$coupon = &new woocommerce_coupon( $code );
@ -372,7 +374,7 @@ class woocommerce_cart {
elseif ($coupon->type=='percent_product') :
$percent_discount = ( $values['data']->get_price_excluding_tax() / 100 ) * $coupon->amount;
$percent_discount = ( $values['data']->get_price_excluding_tax( false ) / 100 ) * $coupon->amount;
$this->discount_product = $this->discount_product + ( $percent_discount * $values['quantity'] );
@ -405,7 +407,7 @@ class woocommerce_cart {
case "percent" :
// Get % off each item - this works out the same as doing the whole cart
$percent_discount = ( $values['data']->get_price_excluding_tax() / 100 ) * $coupon->amount;
$percent_discount = ( $values['data']->get_price_excluding_tax( false ) / 100 ) * $coupon->amount;
$this->discount_product = $this->discount_product + ( $percent_discount * $values['quantity'] );
@ -418,7 +420,7 @@ class woocommerce_cart {
endif;
endforeach;
return $price;
return apply_filters( 'woocommerce_get_discounted_price_', $price, $values, $this );
}
/**
@ -429,6 +431,8 @@ class woocommerce_cart {
if ($this->applied_coupons) foreach ($this->applied_coupons as $code) :
$coupon = &new woocommerce_coupon( $code );
do_action( 'woocommerce_product_discount_after_tax_' . $coupon->type, $coupon );
if ($coupon->type!='fixed_product' && $coupon->type!='percent_product') continue;
if ( !$coupon->apply_before_tax() && $coupon->is_valid() ) :
@ -482,6 +486,8 @@ class woocommerce_cart {
if ($this->applied_coupons) foreach ($this->applied_coupons as $code) :
$coupon = &new woocommerce_coupon( $code );
do_action( 'woocommerce_cart_discount_after_tax_' . $coupon->type, $coupon );
if ( !$coupon->apply_before_tax() && $coupon->is_valid() ) :
switch ($coupon->type) :
@ -494,14 +500,14 @@ class woocommerce_cart {
case "percent" :
$percent_discount = round( ( ($this->cart_contents_total + $this->tax_total) / 100) * $coupon->amount , 2);
$percent_discount = (round( $this->cart_contents_total + $this->tax_total , 2) / 100 ) * $coupon->amount;
$this->discount_total = $this->discount_total + $percent_discount;
break;
endswitch;
endif;
endforeach;
}
@ -514,54 +520,185 @@ class woocommerce_cart {
$this->reset_totals();
// Get count of all items
if (sizeof($this->cart_contents)>0) foreach ($this->cart_contents as $cart_item_key => $values) $this->cart_contents_count = $this->cart_contents_count + $values['quantity'];
// Calc totals for items
// Get count of all items + weights
if (sizeof($this->cart_contents)>0) foreach ($this->cart_contents as $cart_item_key => $values) :
$_product = $values['data'];
$this->cart_contents_weight = $this->cart_contents_weight + ($_product->get_weight() * $values['quantity']);
// Base Price (i.e. no tax, regardless of region)
$base_price = $_product->get_price_excluding_tax();
// Discounted Price (base price with any pre-tax discounts applied
$discounted_price = $this->get_discounted_price( $values, $base_price );
// Tax Amount (For the line, based on discounted, ex.tax price)
if ( get_option('woocommerce_calc_taxes')=='yes' && $_product->is_taxable() ) :
$tax_rate = $this->tax->get_rate( $_product->get_tax_class() );
$tax_amount = $this->tax->calc_tax( $base_price, $tax_rate, false ) * $values['quantity'];
$discounted_tax_amount = $this->tax->calc_tax( $discounted_price, $tax_rate, false ) * $values['quantity'];
else :
$tax_amount = 0;
$discounted_tax_amount = 0;
endif;
// Total item price (discounted price + tax * quantity)
$total_item_price = ($discounted_price*$values['quantity']) + $discounted_tax_amount;
// Add any product discounts (after tax)
$this->apply_product_discounts_after_tax( $values, $total_item_price );
// Sub total is based on base prices (without discounts)
$this->subtotal = $this->subtotal + ($base_price*$values['quantity']) + $tax_amount;
$this->subtotal_ex_tax = $this->subtotal_ex_tax + ($base_price*$values['quantity']);
// Cart contents total is based on discounted prices and is used for the final total calculation
$this->cart_contents_total = $this->cart_contents_total + ($discounted_price*$values['quantity']);
// Cart tax is based on discounted amounts
$this->tax_total = $this->tax_total + $discounted_tax_amount;
$this->cart_contents_weight = $this->cart_contents_weight + ($values['data']->get_weight() * $values['quantity']);
$this->cart_contents_count = $this->cart_contents_count + $values['quantity'];
endforeach;
if (get_option('woocommerce_prices_include_tax')=='yes') :
/**
* Calculate totals for items
*/
if (sizeof($this->cart_contents)>0) : foreach ($this->cart_contents as $cart_item_key => $values) :
/**
* Prices include tax
*
* To prevent rounding issues we need to work with the inclusive price where possible
* otherwise we'll see errors such as when working with a 9.99 inc price, 20% VAT which would
* be 8.325 leading to totals being 1p off
*
* Pre tax coupons come off the price the customer thinks they are paying - tax is calculated
* afterwards.
*
* e.g. $100 bike with $10 coupon = customer pays $90 and tax worked backwards from that
*
* Used this excellent article for reference:
* http://developer.practicalecommerce.com/articles/1473-Coding-for-Tax-Calculations-Everything-You-Never-Wanted-to-Know-Part-2
*/
$_product = $values['data'];
// Base Price (inlusive of tax for now)
$base_price = $_product->get_price();
// Discounted Price (price with any pre-tax discounts applied)
$discounted_price = $this->get_discounted_price( $values, $base_price );
// Base Price Adjustment
if ( get_option('woocommerce_calc_taxes')=='yes' && $_product->is_taxable() ) :
// Get tax rate for base - we will handle customer's outside base later
$tax_rate = $this->tax->get_shop_base_rate( $_product->get_tax_class() );
/**
* Regular tax calculation (customer inside base and the tax class is unmodified
*/
$tax_amount = $this->tax->calc_tax( $base_price * $values['quantity'], $tax_rate, true );
$discounted_tax_amount = $this->tax->calc_tax( $discounted_price * $values['quantity'], $tax_rate, true );
/**
* ADJUST TAX - Checkout calculations when customer is OUTSIDE the shop base country and prices INCLUDE tax
*/
if ( $woocommerce->customer->is_customer_outside_base() && defined('WOOCOMMERCE_CHECKOUT') && WOOCOMMERCE_CHECKOUT ) :
// Get rate
$rate = $this->tax->get_rate( $_product->get_tax_class() );
// Get the price ex. Vat (unrounded)
$adjusted_price = $_product->get_price_excluding_tax( false );
// Get tax amount
$adjusted_tax = $this->tax->calc_tax( $adjusted_price, $rate, false );
// Discounted Price (price with any pre-tax discounts applied)
$discounted_price = $this->get_discounted_price( $values, $adjusted_price + $adjusted_tax );
// Discounted tax amount
$discounted_tax_amount = $this->tax->calc_tax( $discounted_price * $values['quantity'], $rate, true );
/**
* ADJUST TAX - Checkout calculations when a tax class is modified
*/
elseif ( $_product->get_tax_class() !== $_product->tax_class ) :
// Get rates
$original_rate = $this->tax->get_rate( $_product->get_tax_class() );
$new_rate = $this->tax->get_rate( $_product->tax_class );
// Calc tax for original rate
$original_tax_amount = $this->tax->calc_tax( $_product->get_price(), $original_rate, true );
// Now calc tax for new rate (which now excludes tax)
$adjusted_tax = $this->tax->calc_tax( ( $_product->get_price() - $original_tax_amount ), $new_rate, false );
// Discounted Price (price with any pre-tax discounts applied)
$discounted_price = $this->get_discounted_price( $values, ( $_product->get_price() - $original_tax_amount ) + $adjusted_tax );
// Discounted tax amount
$discounted_tax_amount = $this->tax->calc_tax( $discounted_price * $values['quantity'], $new_rate, true );
endif;
// Rounding
if ( get_option( 'woocommerce_tax_round_at_subtotal' ) == 'no' ) :
$tax_amount = round( $tax_amount, 2 );
$discounted_tax_amount = round( $discounted_tax_amount, 2 );
endif;
else :
$tax_amount = $discounted_tax_amount = 0;
endif;
// Total item price (price, discount and quantity) - round tax so price is correctly calculated
$total_item_price = ($discounted_price * $values['quantity']) - round($discounted_tax_amount, 2);
// Add any product discounts (after tax)
$this->apply_product_discounts_after_tax( $values, $total_item_price + $discounted_tax_amount );
// Tax Totals
$this->tax_total = $this->tax_total + $discounted_tax_amount;
// Cart contents total is based on discounted prices and is used for the final total calculation
$this->cart_contents_total = $this->cart_contents_total + $total_item_price;
// Sub total is based on base prices (without discounts)
$this->subtotal = $this->subtotal + ( $base_price * $values['quantity'] );
$this->subtotal_ex_tax = $this->subtotal_ex_tax + ( $base_price * $values['quantity'] ) - round($tax_amount, 2);
endforeach; endif;
else :
if (sizeof($this->cart_contents)>0) : foreach ($this->cart_contents as $cart_item_key => $values) :
/**
* Prices exclude tax
*
* This calculation is simpler - work with the base, untaxed price.
*/
$_product = $values['data'];
// Base Price (i.e. no tax, regardless of region)
$base_price = $_product->get_price_excluding_tax();
// Discounted Price (base price with any pre-tax discounts applied
$discounted_price = $this->get_discounted_price( $values, $base_price );
// Tax Amount (For the line, based on discounted, ex.tax price)
if ( get_option('woocommerce_calc_taxes')=='yes' && $_product->is_taxable() ) :
// Now calc product rates
$tax_rate = $this->tax->get_rate( $_product->get_tax_class() );
$tax_amount = $this->tax->calc_tax( $base_price * $values['quantity'], $tax_rate, false );
$discounted_tax_amount = $this->tax->calc_tax( $discounted_price * $values['quantity'], $tax_rate, false );
// Rounding
if ( get_option( 'woocommerce_tax_round_at_subtotal' ) == 'no' ) :
$tax_amount = round( $tax_amount, 2 );
$discounted_tax_amount = round( $discounted_tax_amount, 2 );
endif;
else :
$tax_amount = $discounted_tax_amount = 0;
endif;
// Total item price (price, discount and quantity)
$total_item_price = $discounted_price * $values['quantity'];
// Add any product discounts (after tax)
$this->apply_product_discounts_after_tax( $values, $total_item_price + $discounted_tax_amount );
// Tax Totals
$this->tax_total = $this->tax_total + $discounted_tax_amount;
// Cart contents total is based on discounted prices and is used for the final total calculation
$this->cart_contents_total = $this->cart_contents_total + $total_item_price;
// Sub total is based on base prices (without discounts)
$this->subtotal = $this->subtotal + ( $base_price * $values['quantity'] ) + $tax_amount;
$this->subtotal_ex_tax = $this->subtotal_ex_tax + $base_price * $values['quantity'];
endforeach; endif;
endif;
// Rounding
if ( get_option( 'woocommerce_tax_round_at_subtotal' ) == 'yes' ) $this->tax_total = round( $this->tax_total, 2 );
// Cart Discounts (after tax)
$this->apply_cart_discounts_after_tax();
@ -578,7 +715,7 @@ class woocommerce_cart {
$this->shipping_total = $woocommerce->shipping->shipping_total; // Shipping Total
$this->shipping_tax_total = $woocommerce->shipping->shipping_tax; // Shipping Tax
// VAT excemption done at this point - so all totals are correct before exemption
// VAT exemption done at this point - so all totals are correct before exemption
if ($woocommerce->customer->is_vat_exempt()) :
$this->shipping_tax_total = $this->tax_total = 0;
endif;
@ -811,10 +948,14 @@ class woocommerce_cart {
}
/**
* gets the cart contens total (after calculation)
* gets the cart contents total (after calculation)
*/
function get_cart_total() {
return woocommerce_price($this->cart_contents_total);
if (get_option('woocommerce_prices_include_tax')=='no') :
return woocommerce_price($this->cart_contents_total);
else :
return woocommerce_price($this->cart_contents_total + $this->tax_total);
endif;
}
/**
@ -823,11 +964,11 @@ class woocommerce_cart {
function get_cart_subtotal() {
global $woocommerce;
if (get_option('woocommerce_display_totals_tax')=='excluding' || ( defined('WOOCOMMERCE_CHECKOUT') && WOOCOMMERCE_CHECKOUT )) :
if (get_option('woocommerce_display_totals_tax')=='excluding') :
$return = woocommerce_price( $this->subtotal_ex_tax );
if ($this->tax_total>0) :
if ($this->tax_total>0 && get_option('woocommerce_prices_include_tax')=='yes') :
$return .= ' <small>'.$woocommerce->countries->ex_tax_or_vat().'</small>';
endif;
return $return;
@ -836,7 +977,7 @@ class woocommerce_cart {
$return = woocommerce_price( $this->subtotal );
if ($this->tax_total>0) :
if ($this->tax_total>0 && get_option('woocommerce_prices_include_tax')=='no') :
$return .= ' <small>'.$woocommerce->countries->inc_tax_or_vat().'</small>';
endif;
return $return;
@ -866,7 +1007,7 @@ class woocommerce_cart {
if (get_option('woocommerce_display_totals_tax')=='excluding') :
$return = woocommerce_price($woocommerce->shipping->shipping_total);
if ($this->shipping_tax_total>0) :
if ($this->shipping_tax_total>0 && get_option('woocommerce_prices_include_tax')=='yes') :
$return .= ' <small>'.$woocommerce->countries->ex_tax_or_vat().'</small>';
endif;
return $return;
@ -874,7 +1015,7 @@ class woocommerce_cart {
else :
$return = woocommerce_price($woocommerce->shipping->shipping_total + $woocommerce->shipping->shipping_tax);
if ($this->shipping_tax_total>0) :
if ($this->shipping_tax_total>0 && get_option('woocommerce_prices_include_tax')=='no') :
$return .= ' <small>'.$woocommerce->countries->inc_tax_or_vat().'</small>';
endif;
return $return;
@ -936,4 +1077,27 @@ class woocommerce_cart {
return (array) $this->applied_coupons;
}
/**
* gets the array of applied coupon codes
*/
function remove_coupons( $type = 0 ) {
if ($type == 1) :
if ($this->applied_coupons) foreach ($this->applied_coupons as $index => $code) :
$coupon = &new woocommerce_coupon( $code );
if ( $coupon->apply_before_tax() ) unset($this->applied_coupons[$index]);
endforeach;
$_SESSION['coupons'] = $this->applied_coupons;
elseif ($type == 2) :
if ($this->applied_coupons) foreach ($this->applied_coupons as $index => $code) :
$coupon = &new woocommerce_coupon( $code );
if ( !$coupon->apply_before_tax() ) unset($this->applied_coupons[$index]);
endforeach;
$_SESSION['coupons'] = $this->applied_coupons;
else :
unset($_SESSION['coupons']);
$this->applied_coupons = array();
endif;
}
}

View File

@ -682,7 +682,7 @@ class woocommerce_checkout {
'variation_id' => $values['variation_id'],
'name' => $_product->get_title(),
'qty' => (int) $values['quantity'],
'cost' => $_product->get_price_excluding_tax(),
'cost' => $_product->get_price_excluding_tax( false ),
'taxrate' => $rate,
'item_meta' => $item_meta->meta
), $values);

View File

@ -187,7 +187,6 @@ class woocommerce_paypal extends woocommerce_payment_gateway {
// Payment Info
'invoice' => $order->order_key,
'tax_cart' => $order->get_total_tax(),
'discount_amount_cart' => $order->get_total_discount()
),
$phone_args
@ -200,6 +199,12 @@ class woocommerce_paypal extends woocommerce_payment_gateway {
$paypal_args['no_shipping'] = 1;
endif;
if (get_option('woocommerce_prices_include_tax')=='yes') :
// Don't pass - paypal borks tax due to prices including tax. PayPal has no option for tax inclusive pricing.
else :
$paypal_args['tax_cart'] = $order->get_total_tax();
endif;
// Cart Contents
$item_loop = 0;
if (sizeof($order->items)>0) : foreach ($order->items as $item) :
@ -214,18 +219,34 @@ class woocommerce_paypal extends woocommerce_payment_gateway {
$item_name .= ' ('.$meta.')';
endif;
$paypal_args['item_name_'.$item_loop] = $item_name;
$paypal_args['quantity_'.$item_loop] = $item['qty'];
$paypal_args['amount_'.$item_loop] = $item['cost'];
if (get_option('woocommerce_prices_include_tax')=='yes') :
// Since prices include tax we cannot send lines, otherwise we will get rounding errors when paypal re-calcs the totals
// Paypal also incorrectly calculates discounts when prices are tax inclusive because coupons are removed from the tax inclusive price
$paypal_args['item_name_'.$item_loop] = $item['qty'] . ' x ' . $item_name;
$paypal_args['quantity_'.$item_loop] = 1;
// Add tax to this cost for paypal for the entire row to prevent rounding issues
$paypal_args['amount_'.$item_loop] = number_format( ($item['cost'] * $item['qty']) * (1 + ($item['taxrate']/100)) , 2, '.', '');
else :
$paypal_args['item_name_'.$item_loop] = $item_name;
$paypal_args['quantity_'.$item_loop] = $item['qty'];
$paypal_args['amount_'.$item_loop] = number_format($item['cost'], 2, '.', '');
endif;
endif;
endforeach; endif;
// Shipping Cost
$item_loop++;
$paypal_args['item_name_'.$item_loop] = __('Shipping cost', 'woothemes');
$paypal_args['quantity_'.$item_loop] = '1';
$paypal_args['amount_'.$item_loop] = number_format($order->order_shipping, 2);
if ($order->order_shipping>0) :
$item_loop++;
$paypal_args['item_name_'.$item_loop] = __('Shipping cost', 'woothemes');
$paypal_args['quantity_'.$item_loop] = '1';
$paypal_args['amount_'.$item_loop] = number_format($order->order_shipping, 2);
endif;
$paypal_args_array = array();

View File

@ -189,6 +189,8 @@ class woocommerce_product {
* @param int $by Amount to reduce by
*/
function reduce_stock( $by = 1 ) {
global $woocommerce;
if ($this->managing_stock()) :
$this->stock = $this->stock - $by;
$this->total_stock = $this->get_total_stock() - $by;
@ -487,7 +489,7 @@ class woocommerce_product {
}
/** Returns the price (excluding tax) - ignores tax_class filters since the price may *include* tax and thus needs subtracting */
function get_price_excluding_tax() {
function get_price_excluding_tax( $round = true ) {
$price = $this->price;
@ -499,16 +501,25 @@ class woocommerce_product {
$_tax = &new woocommerce_tax();
$tax_amount = $_tax->calc_tax( $price, $rate, true );
if ($round) :
$tax_amount = round( $_tax->calc_tax( $price, $rate, true ) , 2);
$price = $price - $tax_amount;
$price = $price - $tax_amount;
// Round
$price = round( $price * 100 ) / 100;
// Round
$price = round( $price * 100 ) / 100;
// Format
$price = number_format($price, 2, '.', '');
// Format
$price = number_format($price, 2, '.', '');
else :
$tax_amount = round( $_tax->calc_tax( $price, $rate, true ), 4);
$price = $price - $tax_amount;
endif;
endif;
endif;

View File

@ -235,22 +235,20 @@ class woocommerce_tax {
*/
function calc_tax( $price, $rate, $price_includes_tax = true ) {
$price = round($price * 10000, 0); // To avoid float rounding errors, work with integers (pence + 2 dp = 4 decimals)
$rate = $rate * 100;
$price = $price * 100; // To avoid float rounding errors, work with integers (pence)
if ($price_includes_tax) :
$rate = ($rate / 10000) + 1;
$rate = ($rate / 100) + 1;
$tax_amount = $price - ( $price / $rate);
else :
$tax_amount = $price * ($rate/10000);
$tax_amount = $price * ($rate/100);
endif;
$tax_amount = round($tax_amount, 0); // Round to the nearest pence
$tax_amount = $tax_amount / 10000; // Back to pounds
$tax_amount = $tax_amount / 100; // Back to pounds
return $tax_amount;
return $tax_amount; // Return unrounded
//return number_format($tax_amount, 2, '.', '');
}

View File

@ -82,11 +82,14 @@ Yes you can! Join in on our GitHub repository :) https://github.com/woothemes/wo
== Changelog ==
= 1.3 - 18/11/2011 =
= 1.3 - xx/11/2011 =
* Minor bug fixes
* Schema.org markup for products and reviews
* Option to apply coupons before tax
* Rewritten cart calculations to support coupons before tax and after tax (optional)
* Option to apply coupons before tax (per coupon)
* Rewritten cart tax calculations to support coupons before tax and after tax
* 2 lines of discounts on total tables - 1 for product discounts, 1 for after tax discounts (e.g. store credit)
* Tweaked paypal to work with tax inclusive prices without screwing up rounding
* Stored ex. prices with higher precision to prevent rounding errors
= 1.2.4 - 18/11/2011 =
* More sale price logic fixes for variations. Now correctly compares variation's prices.

View File

@ -24,7 +24,15 @@ function woocommerce_cart( $atts ) {
$coupon_code = stripslashes(trim($_POST['coupon_code']));
$woocommerce->cart->add_discount($coupon_code);
// Remvoe Discount Codes
elseif (isset($_GET['remove_discounts'])) :
$woocommerce->cart->remove_coupons( $_GET['remove_discounts'] );
// Re-calc price
$woocommerce->cart->calculate_totals();
// Update Shipping
elseif (isset($_POST['calc_shipping']) && $_POST['calc_shipping'] && $woocommerce->verify_nonce('cart')) :
@ -59,7 +67,7 @@ function woocommerce_cart( $atts ) {
$woocommerce->add_message( __('Shipping costs updated.', 'woothemes') );
endif;
endif;
do_action('woocommerce_check_cart_items');

View File

@ -91,7 +91,15 @@
<tr>
<td class="product-name">'.$_product->get_title().$woocommerce->cart->get_item_data( $values ).'</td>
<td>'.$values['quantity'].'</td>
<td>'.woocommerce_price($_product->get_price_excluding_tax()*$values['quantity'], array('ex_tax_label' => 1)).'</td>
<td>';
if (get_option('woocommerce_prices_include_tax')=='yes') :
echo woocommerce_price($_product->get_price()*$values['quantity']);
else :
echo woocommerce_price($_product->get_price()*$values['quantity']);
endif;
echo '</td>
</tr>';
endif;
endforeach;

View File

@ -21,7 +21,7 @@ class WooCommerce_Widget_Cart extends WP_Widget {
/* Widget variable settings. */
$this->woo_widget_cssclass = 'widget_shopping_cart';
$this->woo_widget_description = __( 'Display the users Shopping Cart in the sidebar.', 'woothemes' );
$this->woo_widget_description = __( "Display the user's Shopping Cart in the sidebar.", 'woothemes' );
$this->woo_widget_idbase = 'woocommerce_shopping_cart';
$this->woo_widget_name = __('WooCommerce Shopping Cart', 'woothemes' );

View File

@ -731,8 +731,8 @@ if (!function_exists('woocommerce_cart_totals')) {
</tr>
<?php if ($woocommerce->cart->get_discounts_before_tax()) : ?><tr class="discount">
<th><?php _e('Product Discounts', 'woothemes'); ?></th>
<td>-<?php echo $woocommerce->cart->get_discounts_before_tax(); ?></td>
<th><?php _e('Product Discounts', 'woothemes'); ?> <a href="<?php echo add_query_arg('remove_discounts', '1') ?>"><?php _e('[Remove]', 'woothemes'); ?></a></th>
<td>&ndash;<?php echo $woocommerce->cart->get_discounts_before_tax(); ?></td>
</tr><?php endif; ?>
<?php if ($woocommerce->cart->get_cart_shipping_total()) : ?><tr>
@ -786,7 +786,7 @@ if (!function_exists('woocommerce_cart_totals')) {
</tr><?php endif; ?>
<?php if ($woocommerce->cart->get_discounts_after_tax()) : ?><tr class="discount">
<th><?php _e('Discount', 'woothemes'); ?></th>
<th><?php _e('Discount', 'woothemes'); ?> <a href="<?php echo add_query_arg('remove_discounts', '2') ?>"><?php _e('[Remove]', 'woothemes'); ?></a></th>
<td>-<?php echo $woocommerce->cart->get_discounts_after_tax(); ?></td>
</tr><?php endif; ?>