per product flat rate. Closes #979.

This commit is contained in:
Mike Jolley 2012-04-23 15:32:21 +01:00
parent 375d973128
commit fc0e067613
2 changed files with 9 additions and 4 deletions

View File

@ -198,6 +198,14 @@ class WC_Flat_Rate extends WC_Shipping_Method {
if ($per_order_cost) {
$extra_rate['cost']['order'] = $this_cost;
} else {
$total_quantity = 0;
// Shipping per item
foreach ( $package['contents'] as $item_id => $values )
if ( $values['quantity'] > 0 && $values['data']->needs_shipping() )
$total_quantity += $values['quantity'];
// Per-product shipping
$extra_rate['cost']['order'] = $this_cost * $total_quantity;
}
@ -307,7 +315,6 @@ class WC_Flat_Rate extends WC_Shipping_Method {
function item_shipping( $package ) {
// Per item shipping so we pass an array of costs (per item) instead of a single value
$costs = array();
$total_quantity = 0;
// Shipping per item
foreach ( $package['contents'] as $item_id => $values ) {
@ -327,9 +334,6 @@ class WC_Flat_Rate extends WC_Shipping_Method {
}
$costs[$item_id] = ( ( $cost + $fee ) * $values['quantity'] );
$total_quantity += $values['quantity'];
}
}

View File

@ -162,6 +162,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
* Fix - update_count_callback for tags
* Fix - Pass shipping calc state to checkout
* Fix - Removed space from postcode validation
* Fix - per product flat rate.
* Localization - Slovak translation by Dušan Beleščák
* Localization - Updated localisations