Allow max_fee in addition to min_fee in flat rate costs fields.
Closes #11151
This commit is contained in:
parent
7266e020fb
commit
b682c0550e
|
@ -98,7 +98,8 @@ class WC_Shipping_Flat_Rate extends WC_Shipping_Method {
|
||||||
public function fee( $atts ) {
|
public function fee( $atts ) {
|
||||||
$atts = shortcode_atts( array(
|
$atts = shortcode_atts( array(
|
||||||
'percent' => '',
|
'percent' => '',
|
||||||
'min_fee' => ''
|
'min_fee' => '',
|
||||||
|
'max_fee' => '',
|
||||||
), $atts );
|
), $atts );
|
||||||
|
|
||||||
$calculated_fee = 0;
|
$calculated_fee = 0;
|
||||||
|
@ -111,6 +112,10 @@ class WC_Shipping_Flat_Rate extends WC_Shipping_Method {
|
||||||
$calculated_fee = $atts['min_fee'];
|
$calculated_fee = $atts['min_fee'];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $atts['max_fee'] && $calculated_fee > $atts['max_fee'] ) {
|
||||||
|
$calculated_fee = $atts['max_fee'];
|
||||||
|
}
|
||||||
|
|
||||||
return $calculated_fee;
|
return $calculated_fee;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ if ( ! defined( 'ABSPATH' ) ) {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
$cost_desc = __( 'Enter a cost (excl. tax) or sum, e.g. <code>10.00 * [qty]</code>.', 'woocommerce' ) . '<br/>' . __( 'Supports the following placeholders: <code>[qty]</code> = number of items, <code>[cost]</code> = cost of items, <code>[fee percent="10" min_fee="20"]</code> = Percentage based fee.', 'woocommerce' );
|
$cost_desc = __( 'Enter a cost (excl. tax) or sum, e.g. <code>10.00 * [qty]</code>.', 'woocommerce' ) . '<br/><br/>' . __( 'Use <code>[qty]</code> for the number of items, <br/><code>[cost]</code> for the total cost of items, and <code>[fee percent="10" min_fee="20" max_fee=""]</code> for percentage based fees.', 'woocommerce' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Settings for flat rate shipping.
|
* Settings for flat rate shipping.
|
||||||
|
@ -32,7 +32,7 @@ $settings = array(
|
||||||
'type' => 'text',
|
'type' => 'text',
|
||||||
'placeholder' => '',
|
'placeholder' => '',
|
||||||
'description' => $cost_desc,
|
'description' => $cost_desc,
|
||||||
'default' => '',
|
'default' => '0',
|
||||||
'desc_tip' => true
|
'desc_tip' => true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -174,6 +174,7 @@ Yes you can! Join in on our [GitHub repository](http://github.com/woothemes/wooc
|
||||||
* Tweak - Hide 'payment methods' screen if no methods support it.
|
* Tweak - Hide 'payment methods' screen if no methods support it.
|
||||||
* Tweak - If shipping method count changes, reset to default.
|
* Tweak - If shipping method count changes, reset to default.
|
||||||
* Tweak - Avoid normalization of zone postcodes so wildcard matching can be performed on postcodes with spaces. E.g. SP1 *
|
* Tweak - Avoid normalization of zone postcodes so wildcard matching can be performed on postcodes with spaces. E.g. SP1 *
|
||||||
|
* Tweak - Allow max_fee in addition to min_fee in flat rate costs fields.
|
||||||
|
|
||||||
= 2.6.0 - 14/06/16 =
|
= 2.6.0 - 14/06/16 =
|
||||||
* Feature - Introduced Shipping Zone functionality, and re-usable instance based shipping methods.
|
* Feature - Introduced Shipping Zone functionality, and re-usable instance based shipping methods.
|
||||||
|
|
Loading…
Reference in New Issue