includes/shipping/flat-rate/class-wc-shipping-flat-rate.php 1 location
|
@@ 99-116 (lines=18) @@
|
96 |
|
* @param array $atts |
97 |
|
* @return string |
98 |
|
*/ |
99 |
|
public function fee( $atts ) { |
100 |
|
$atts = shortcode_atts( array( |
101 |
|
'percent' => '', |
102 |
|
'min_fee' => '' |
103 |
|
), $atts ); |
104 |
|
|
105 |
|
$calculated_fee = 0; |
106 |
|
|
107 |
|
if ( $atts['percent'] ) { |
108 |
|
$calculated_fee = $this->fee_cost * ( floatval( $atts['percent'] ) / 100 ); |
109 |
|
} |
110 |
|
|
111 |
|
if ( $atts['min_fee'] && $calculated_fee < $atts['min_fee'] ) { |
112 |
|
$calculated_fee = $atts['min_fee']; |
113 |
|
} |
114 |
|
|
115 |
|
return $calculated_fee; |
116 |
|
} |
117 |
|
|
118 |
|
/** |
119 |
|
* calculate_shipping function. |
includes/shipping/legacy-flat-rate/class-wc-shipping-legacy-flat-rate.php 1 location
|
@@ 117-134 (lines=18) @@
|
114 |
|
* @param array $atts |
115 |
|
* @return string |
116 |
|
*/ |
117 |
|
public function fee( $atts ) { |
118 |
|
$atts = shortcode_atts( array( |
119 |
|
'percent' => '', |
120 |
|
'min_fee' => '' |
121 |
|
), $atts ); |
122 |
|
|
123 |
|
$calculated_fee = 0; |
124 |
|
|
125 |
|
if ( $atts['percent'] ) { |
126 |
|
$calculated_fee = $this->fee_cost * ( floatval( $atts['percent'] ) / 100 ); |
127 |
|
} |
128 |
|
|
129 |
|
if ( $atts['min_fee'] && $calculated_fee < $atts['min_fee'] ) { |
130 |
|
$calculated_fee = $atts['min_fee']; |
131 |
|
} |
132 |
|
|
133 |
|
return $calculated_fee; |
134 |
|
} |
135 |
|
|
136 |
|
/** |
137 |
|
* calculate_shipping function. |