per product flat rate. Closes #979.
This commit is contained in:
parent
375d973128
commit
fc0e067613
|
@ -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'];
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue